DataReader Issue

NicoVB

Well-known member
Joined
Jan 2, 2002
Messages
160
Location
Belgium
In one tab of a tabcontrol Im 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
 
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????
 
While a data reader is open, its associated connection cant 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.
 
You can not stop a DataReader with predictable results (if any). Period. You need to use two or more connections as JABE has mentioned.
 
Back
Top