Home All Groups Group Topic Archive Search About

Need to close DataReader?

Author
13 Feb 2006 1:21 AM
ad
If it need to close DataReader after read?
I am study the Data Access Application Block for .Net Framework2.0 form
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlibjan2006_dataaccessappblock.asp

I found the the DataReaders in the examples are not close explicitly in
program.

Dose it need to close DataReader after read?

Author
13 Feb 2006 2:03 AM
W.G. Ryan eMVP
One way to deal with this is to use the CloseConnection commandbehavior.  In
the old days, you needed to close the connection for another reader to use
it. Now with MARS this isn't the case but that doesn't mean you want to
leave it open.  When you've retrieved all the records, you want to make sure
the reader is closed. The most important thign to close is the connection
although the DAAB handles this.
Show quote
"ad" <fly***@wfes.tcc.edu.tw> wrote in message
news:OVSpBvDMGHA.2992@tk2msftngp13.phx.gbl...
> If it need to close DataReader after read?
> I am study the Data Access Application Block for .Net Framework2.0 form
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlibjan2006_dataaccessappblock.asp
>
> I found the the DataReaders in the examples are not close explicitly in
> program.
>
> Dose it need to close DataReader after read?
>
>

AddThis Social Bookmark Button