|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
OleDbDataReader "Closed" ProblemI've made some changes to the structure of my code around a bunch of my pages
which access the database and now I'm getting a very occasional error at DataBind() time saying that my OleDbDataReader object is already closed. I'm working on debugging this but, in the mean time, I wanted to see if someone could explain to me *when* a DataReader object gets closed, because this comfuses me. I'm assuming that the DataReader object gets closed and becomes inaccessible when the Database Connection object is closed. Fine. But other their other circumstances when the DataReader gets closed even when the database Connection is still open? Alex Alex - are you using a COmmandBehavior? Close connection will close the
underlying connection when the reader closes. If the connection closes then the reader can't operate. If you're using Databind, I believe it closes the reader when it's done, lemme look and make sure - I know I remember reading something about this a while ago. Show quote "Alex Maghen" <AlexMaghen@newsgroup.nospam> wrote in message news:A392538E-53E0-4EF3-AB70-10D7AA14698F@microsoft.com... > I've made some changes to the structure of my code around a bunch of my > pages > which access the database and now I'm getting a very occasional error at > DataBind() time saying that my OleDbDataReader object is already closed. > > I'm working on debugging this but, in the mean time, I wanted to see if > someone could explain to me *when* a DataReader object gets closed, > because > this comfuses me. I'm assuming that the DataReader object gets closed and > becomes inaccessible when the Database Connection object is closed. Fine. > But > other their other circumstances when the DataReader gets closed even when > the > database Connection is still open? > > Alex Are you testing the DataReader.HasRows before binding?
-- Show quote____________________________________ William (Bill) Vaughn Author, Mentor, Consultant Microsoft MVP INETA Speaker www.betav.com/blog/billva www.betav.com Please reply only to the newsgroup so that others can benefit. This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________ "Alex Maghen" <AlexMaghen@newsgroup.nospam> wrote in message news:A392538E-53E0-4EF3-AB70-10D7AA14698F@microsoft.com... > I've made some changes to the structure of my code around a bunch of my > pages > which access the database and now I'm getting a very occasional error at > DataBind() time saying that my OleDbDataReader object is already closed. > > I'm working on debugging this but, in the mean time, I wanted to see if > someone could explain to me *when* a DataReader object gets closed, > because > this comfuses me. I'm assuming that the DataReader object gets closed and > becomes inaccessible when the Database Connection object is closed. Fine. > But > other their other circumstances when the DataReader gets closed even when > the > database Connection is still open? > > Alex |
|||||||||||||||||||||||