NicoVB Posted July 4, 2003 Posted July 4, 2003 In one tab of a tabcontrol I'm loading information from a database with a DataReader. But this takes quite a bit of time, so I use Application.DoEvents() But I have also another tab that loads also information with another DataReader. Problem: ------------ When the first data is loading, I click on the other tab, so to have the other information. But it gives an error, because I have two open DataReaders. Does someone has a solution for that??? Maybe a solution for this is STOPPING the first DataReader and starting the other, but how do you do that in code because of the different procedures that are running during the process???? Thanks Nico Quote Visit http://www.nico.gotdns.com Now ONLINE!
JABE Posted July 4, 2003 Posted July 4, 2003 How about giving the 2 data readers separate database connections? Quote
NicoVB Posted July 4, 2003 Author Posted July 4, 2003 Yep, I thought about that, but that takes more time. Maybe a better solution is STOPPING the first DataReader and starting the other, but how do you do that in code because of the different procedures that are running during the process???? Quote Visit http://www.nico.gotdns.com Now ONLINE!
JABE Posted July 4, 2003 Posted July 4, 2003 While a data reader is open, its associated connection can't be used by any other object. Even if you stop the first data reader and start the other but if the same db connection is used for the second, you will still get an error. Quote
*Gurus* Derek Stone Posted July 4, 2003 *Gurus* Posted July 4, 2003 You can not stop a DataReader with predictable results (if any). Period. You need to use two or more connections as JABE has mentioned. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.