Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Sql Server insert problems

Author  Topic 

wsthomp
Starting Member

2 Posts

Posted - 2004-07-06 : 16:45:01
I have written a C# application that inserts data into a table in a loop. While the loop is executing the program sleeps for a period of time and then resumes. My problem is that the data from the inserts does not appear in the table until the application is completly finished running. How can I make it appear in realtime?


Thanks for any help

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2004-07-06 : 17:13:36
Are you doing all your inserts inside a transaction? If so, the data won't be available until the transaction commits or you run a query with the isolation level set to Read Uncommitted.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-07-06 : 18:11:15
Why the sleep in the first place? Did you start a transaction, do your inserts, and then commit the transaction?

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

wsthomp
Starting Member

2 Posts

Posted - 2004-07-06 : 22:29:07
I think it has something to do with the fact that a data reader is open during the inserts. Could this be the problem? HOw should I fix it. Should I create seperate transactions for the inserts and the reader or should they be on the same transaction.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-07-07 : 08:02:17
If you can get away from transactions in general, that's going to make it faster.

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2004-07-07 : 08:37:42
Are you doing the inserts on the same connection as an active datareader?

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -