IDataReader on closed connection

  • Thread starter Thread starter Tamir Khason
  • Start date Start date
T

Tamir Khason

As far as I understand, IDataReader, based on command recieves isClosed
property when the connection closes.
How to prevent it?
 
If you are looking for a way to use a IDataReader object after the
underlying connection is closed, I don't believe you'll find a way to
do that. It is desgined to be associated with a live connection.

If you want to work with the data after a connection is closed, look
at the DataSet class.
 
I do not want to use dataset class due its overhead
are there any "disconnected" readers?
 
Tamir,

The data set is the only way you are going to be able to do this. You
have to connect at some point to get the data, and a data adapter actually
gets a data reader to populate a data set. If you did have a "disconnected"
reader of some sort, then it would just be an iteration over a data set
anyways (or some other storage in memory).

If you want to work with the data in a disconnected way, use the
dataset.

Hope this helps.
 
Hi Tamir,

Thanks for posting in this group.
Based on my understanding, you want to use a disconnected reader for
database.
Because you have disconnected the databse, all the data you want to read
should be stored in the memory. In ADO, the in-memory representation of
data is the recordset. In ADO.NET, it is the dataset.
For performance, if you do not want to retrieve the whole table data into
memory, I think you can use SQL statement to get the data subset you
wanted.
The article below compares the dataset and the recordset:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbconadopreviousversionsofado.asp

All in all, in ADO.net the dataset is the only way for disconnected data
reading.
If you still have any conern, please feel free to tell me. I will work with
you.

Have a nice day!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Tamir,

Does my reply make sense to you
If you still have any concern, please feel free to tell me. I will work
with you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Yes, I understand it.
Just override it by creation custom reader. This works OK and without the
overhead of dataset
 
Back
Top