views:

71

answers:

5

Hi everyone,

I have the most bizarre problem (at least it is bizarre to me) with SQL Server Express 2008.

The problem is the following:

On the development machine I use SQL Server 2008 Enterprise....I get some data from a WCF service and write that data to the database (simple as it can be)....I should point out however that the writing, it is done in a separate thread. But, anyway no problems during development...all the data is there.

Then I set everything up(connection strings .\SQLEXPRESS, other settings) build in Release and copy that to a test machine that has SQL Server Express installed (because my application is a client application and it should work with Express)... I run the program.... the program retrieves the data from the service... and when I look at the database... I'm in for a big surprise... there's only one row written (the first row received from the WCF service).

I would really appreciate any help...I'm in a deadlock here.

Thanks in advance.

Bojan

A: 

could you post your code? Maybe we can find the error there...

MUG4N
I can't post the whole code here....one reason is that it is pretty standard code for writing to db using linq, and the other reason is that it is spread across several modules(DAL, GUI etc.)
bojanskr
+1  A: 

Double-check everything (especially connection strings). Have your app output a log file which might help debug your problem.

Check the main DB also to make sure the entries aren't inadvertently written to the development database.

Steven
I should probably double check the connection strings, that's a good point.BTW, I do log everything(it shows no exceptions whatsoever), just reports that it's done without actually doing anything.Could this be an issue between different versions of SQL server?
bojanskr
Actually, I have only minimal experience with SQL server. I just answered it as a general programming question. Could you query the database right after insert to confirm the entries are written at all? Don't just log exceptions. For debugging, also log values of any relevant variables or expressions.
Steven
You might not have the experience but you give me ideas.About the log...I do all that...log every single step even, with variables and everything, I also checked that the data is there...it is actually there(on the development machine), but only one single row per table on the test machine(the one using SQL express)
bojanskr
A: 

Have you by any chance set(I know this is unlikely)

set ROWCOUNT 1 
josephj1989
no, I'm afraid not, my guess that it has something to do with the connection strings or the different versions of SQL server.
bojanskr
+1  A: 

Are you able to profile what is actually being called on the sql server?

Open up the sql server profiler, point the sql express instance and make sure you pull the RPC:Completed and Sql Statement Completed. You can uncheck the rest of the default, this might be able to tell you how its possibly calling it differently on the server.

Other thoughts: Is the command type correct?

Is a top slipping in there some how?

Zielyn
+1 SQL Profiler is definitely the way to go.
Martin Smith
A: 

OK, someone will find this interesting...

After a thorough analysis this happened:

I moved the code that was writing the data to the db that was running in a different thread to the same thread as the GUI....and no problem it works fine...it writes all the data to the database.

I looked further on and came up on an article on the web saying that SQL Express has only one scheduler(and of course one processor etc.)...and therefore it doesn't support multiple threads writing to the database at once(anyone else knows more about this?)...therefore the solution for this is probably creating a queue and just send stuff to it as it arrives and write data one by one to the database.

bojanskr
That sounds very wrong to me on the face of it. SQL Express definitely supports concurrent users
Martin Smith
It does sound very strange I must admit...but I tried it(using multiple threads to write to the db) and it didn't work
bojanskr
@bojanskr How does your multi threads approach work? Is it doing something any different or more exotic than what would happen if multiple different users were to access the database concurrently? Also I agree with Zielyn that you should use SQL Profiler (Doesn't come with express but you should be able to profile from your enterprise edition)
Martin Smith