Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datareader and connection object

Status
Not open for further replies.

smsinger3

Programmer
Oct 5, 2000
192
US
If I a use a single connection for a datareader object, can I also use that same connection object for other things or do I have to wait until the datareader is finished with it?

Thanks ;-)

SteveS
 
You can use one single connection object through your entire page if you need to. What do you mean by using the same connectiong before the datareader is finished? what are you trying to do?
 
As I am reading my first datareader, I want to create another one before I am done with the first, so I will have to datareaders open at the same time. I want to use the same connection object for both. I thought I read somewhere that you can't do that (but I'm sure that's not the case)...
 
To my best knowledge:
the datareader is the only .net data object that will keep a connection open. While you are using the first datareader, the database will put a lock on the table/s you are reading and hold the lock until the datareader has completed going through all the records. Therefore the second datareader will not be able to read the those tables at that time.

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top