0

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.

4
  • 4
    Nobody is going to be able to help you with the information you've given. You need to provide some code, and explain what you're doing in more detail. Jun 3, 2010 at 20:12
  • code? i just said writing simple data to database....no need for code...furthermore that it has nothing to do with the code but rather with the settings on the machines.
    – TehBoyan
    Jun 3, 2010 at 20:34
  • 1
    could you set up SQL Server Express on your dev machine and try to store data into its tables? I don't see how SQL Server Enterprise and Express could be that different to behave like this. If it works on your DEV machine with SQL Server Express, you'll know the database edition is not the problem in your case....
    – marc_s
    Jun 3, 2010 at 21:10
  • thanks, marc_s, that is an interesting point, I'll certainly give it a try...what I can't understand is....why does it write just 1 row....if something's not right it should either throw an exception or not work at all. Rather strange, don't you think?
    – TehBoyan
    Jun 3, 2010 at 21:16

4 Answers 4

2

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?

0
1

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.

3
  • 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?
    – TehBoyan
    Jun 3, 2010 at 20:29
  • 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
    Jun 3, 2010 at 20:33
  • 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)
    – TehBoyan
    Jun 3, 2010 at 20:39
1

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

set ROWCOUNT 1 
1
  • no, I'm afraid not, my guess that it has something to do with the connection strings or the different versions of SQL server.
    – TehBoyan
    Jun 3, 2010 at 20:35
0

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.

3
  • That sounds very wrong to me on the face of it. SQL Express definitely supports concurrent users Jun 4, 2010 at 11:58
  • 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
    – TehBoyan
    Jun 4, 2010 at 12:05
  • 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) Jun 4, 2010 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.