From: le r. a. <ar...@me...> - 2006-05-26 09:07:28
|
Hello, I have a problem with this code in an asp.net 2.0 applicattion: FbDataReader d; FbConnection fb = new FbConnection(ConfigurationManager.ConnectionStrings["Template"].ConnectionString); fb.Open(); FbCommand fc = new FbCommand("select * from categories", fb); d = fc.ExecuteReader(CommandBehavior.CloseConnection); GridView1.DataSource = d; GridView1.DataBind(); The problem is that the connection is not closed after the gridview databind and the property fbdatareader.isclosed is false or with other provider as oracle or sql server the connection is closed It'is a bug or not ? |
From: Jiri C. <di...@ci...> - 2006-05-26 10:21:36
|
On 26.5.2006 11:07 +0200 le roy arnaud wrote: > The problem is that the connection is not closed after the gridview databind > and the property fbdatareader.isclosed is false or with other provider as > oracle or sql server the connection is closed > > > > It'is a bug or not ? Do you have pooling swithced off? -- Jiri Cincura http://www.cincura.net/ |
From: le r. a. <ar...@me...> - 2006-05-29 12:13:34
|
> Do you have pooling swithced off? No pooling is on why ? |
From: <car...@gm...> - 2006-05-29 13:17:08
|
Hello: > No pooling is on why ? Pooling is on by default. I think the difference agaisnt sqlclient maybe in the dispose implementation, i have it modified in my local tree but i want to wait first to see if you can answer my last question, before commit something -- Carlos Guzmán Álvarez Vigo-Spain http://carlosga.blogspot.com/ No hay un solo rey que no descienda de un esclavo, ni un esclavo que no haya tenido reyes en su familia. |
From: Le r. A. <ar...@me...> - 2006-05-29 13:39:02
|
> Pooling is on by default. > > I think the difference agaisnt sqlclient maybe in the dispose implementation, > i have it modified in my local tree but i want to wait first to see if you > can answer my last question, before commit something I put a breakpoint into the fbdatareader close method and this method is never called ! i think also that the dispose implementation is diferent. |
From: Le r. A. <ar...@me...> - 2006-05-29 14:20:41
|
> > I put a breakpoint into the fbdatareader close method and this method is > never called ! After a databind of course :) |
From: <car...@gm...> - 2006-05-29 15:30:06
|
Hello: > After a databind of course :) Ok change committed into the CVS could you give a try to it when it's ready for pserver connections ?? -- Carlos Guzmán Álvarez Vigo-Spain http://carlosga.blogspot.com/ No hay un solo rey que no descienda de un esclavo, ni un esclavo que no haya tenido reyes en su familia. |
From: Jiri C. <di...@ci...> - 2006-05-29 15:08:22
|
On 29.5.2006 14:13 +0200 le roy arnaud wrote: >> Do you have pooling swithced off? > > No pooling is on why ? > I think, that the problem is, that the connection is in pool for next use, to save time for opening connection again. Try to switch it off. -- Jiri Cincura http://www.cincura.net/ |
From: le r. a. <ar...@me...> - 2006-05-30 04:52:05
|
> Hello: >> After a databind of course :) > Ok change committed into the CVS could you give a try to it when it's > ready for pserver connections ?? > I try the new dispose implemmentation but it doesn't work the properties have not changed and the connection still open :( I search also but for the moment i don't find witch method is called by the data binding method to close the datareader and the connection :( Ps: In the others providers the databind method set the property datareader property isclosed to true only if the CommandBehavior is to CloseConnection; So i think that all the problem is in the dispose implementation ! |
From: <car...@gm...> - 2006-05-30 06:54:11
|
Hello: > I try the new dispose implemmentation but it doesn't work the properties > have not changed and the connection still open :( > > I search also but for the moment i don't find witch method is called by the > data binding method to close the datareader and the connection :( > And is the Dispose being called ?? -- Carlos Guzmán Álvarez Vigo-Spain http://carlosga.blogspot.com/ No hay un solo rey que no descienda de un esclavo, ni un esclavo que no haya tenido reyes en su familia. |
From: Le r. A. <ar...@me...> - 2006-05-30 08:13:08
|
> Hello: >> I try the new dispose implemmentation but it doesn't work the properties >> have not changed and the connection still open :( >> >> I search also but for the moment i don't find witch method is called by t= >> he data binding method to close the datareader and the connection :( >> = > > And is the Dispose being called ?? No but i found the solution in fact when a control do a databind with a datareader the overiden method GetEnumerator is called and currently it returns "New Dbenumerator(this)" or it sould return "New DbEnumerator(this,(CommandBehavior.Default !=(CommandBehavior.CloseConnection & this.CommandBehavior)));" Thanks a lot Carlos for you help and please tell me if this solution is good for you ? |
From: le r. a. <ar...@me...> - 2006-05-30 06:04:16
|
> Ps: In the others providers the databind method set the property > datareader > property isclosed to true only if the CommandBehavior is to > CloseConnection; > So i think that all the problem is in the dispose implementation ! ^ NOT |
From: <car...@gm...> - 2006-05-28 11:37:12
|
Hello: > The problem is that the connection is not closed after the gridview databind > and the property fbdatareader.isclosed is false or with other provider as > oracle or sql server the connection is closed If that happens is because the Close Method is not being called, can you try to build the provider sources and put a breakpoint in the FbDataReader.Close method to see if it's getting called ?? -- Carlos Guzmán Álvarez Vigo-Spain http://carlosga.blogspot.com/ No hay un solo rey que no descienda de un esclavo, ni un esclavo que no haya tenido reyes en su familia. |
From: le r. a. <ar...@me...> - 2006-05-29 08:15:51
|
i do some search and the isclosed property of sqldatareader is set to true after a databind only if the commandbehavior is set to closeconnection ! So i put a breakpoint in the fbdatareader close method and she is never called. More over the last fbdatareader method called by the databind is Read so i think the sql server or oracle provider close the datareader in this method ? So can you fix it in the next version ? > If that happens is because the Close Method is not being called, can you > try to build the provider sources and put a breakpoint in the > FbDataReader.Close method to see if it's getting called ?? > |
From: <car...@gm...> - 2006-05-29 15:18:12
|
Hello: > i do some search and the isclosed property of sqldatareader is set to true > after a databind only if the commandbehavior is set to closeconnection ! > So i put a breakpoint in the fbdatareader close method and she is never > called. More over the last fbdatareader method called by the > databind is Read so i think the sql server or oracle provider close the > datareader in this method ? It maybe ... i will try to confirm it .. if possible .... :P Can you check in the case of sql server what is the state of the data reader immediatly after the instruction where you do the data binding ?? -- Carlos Guzmán Álvarez Vigo-Spain http://carlosga.blogspot.com/ No hay un solo rey que no descienda de un esclavo, ni un esclavo que no haya tenido reyes en su familia. |
From: Le r. A. <ar...@me...> - 2006-05-29 15:39:40
|
> It maybe ... i will try to confirm it .. if possible .... :P > > Can you check in the case of sql server what is the state of the data reader > immediatly after the instruction where you do the data binding ?? > the data reader state after the data binding in the sql server provider is : PROPERTY : IsClosed = true Private : Command = null |
From: Le r. A. <ar...@me...> - 2006-05-29 15:45:53
|
>It maybe ... i will try to confirm it .. if possible .... >Can you check in the case of sql server what is the state of the data reader > immediatly after the instruction where you do the data binding ?? the data reader state after the data binding in the sql server provider is : PROPERTY : IsClosed = true Private : Command = null Connection = null More over i continue my search and i find that if i do a dispose of sqlcommand before the databind, the datareader is not closed !! Exemple : SqlDataReader d; SqlConnection fb = new SqlConnection(ConfigurationManager.ConnectionStrings["dsncom"].ConnectionString); fb.Open(); SqlCommand fc = new SqlCommand("select * from categories", fb); d = fc.ExecuteReader(CommandBehavior.CloseConnection); fc.Dispose(); // With this line the datareader is not closed and the connection stay open after the databind ! GridView1.DataSource = d; GridView1.DataBind(); if you have an idea ? |
From: le r. a. <ar...@me...> - 2006-05-30 04:53:06
|
> The problem is that the connection is not closed after the gridview > databind > and the property fbdatareader.isclosed is false or with other provider as > oracle or sql server the connection is closed > > > > It'is a bug or not ? OK i found the solution in fact when a control do a databind with a datareader the overiden GetEnumerator is called and now it returns "New Dbenumerator(this)" or it sould return "New DbEnumerator(this,(CommandBehavior.Default != (CommandBehavior.CloseConnection & this._behavior)));" Thanks a lot Carlos for you help and please tell me if this solution is good for you ? |
From: <car...@gm...> - 2006-05-30 08:11:11
|
Hello: > OK i found the solution in fact when a control do a databind with a > datareader the overiden GetEnumerator is called and now it returns "New > Dbenumerator(this)" or it sould return "New > DbEnumerator(this,(CommandBehavior.Default != > (CommandBehavior.CloseConnection & this._behavior)));" > > Thanks a lot Carlos for you help and please tell me if this solution is good > for you ? What about this one: return new DbEnumerator(this, this.IsCommandBehavior(CommandBehavior.CloseConnection)); -- Carlos Guzmán Álvarez Vigo-Spain http://carlosga.blogspot.com/ No hay un solo rey que no descienda de un esclavo, ni un esclavo que no haya tenido reyes en su familia. |
From: Le r. A. <ar...@me...> - 2006-05-30 08:22:15
|
> What about this one: > > return new DbEnumerator(this, = > > this.IsCommandBehavior(CommandBehavior.CloseConnection)); In fact when the second parameter of the dbenumerator constructor is true the datareader is automatically close at the end of the iteration; "MSDN said" : [DbEnumerator (IDataReader, Boolean) Initializes a new instance of the DbEnumerator class using the specified DataReader, and indicates whether to automatically close the DataReader after iterating through its data.] So when the commandbehavior is set to closeconnection the second parameter is set to true else is set to false ! |
From: <car...@gm...> - 2006-05-30 08:51:32
|
Hello: > In fact when the second parameter of the dbenumerator constructor is > true the datareader is automatically close at the end of the iteration; > "MSDN said" : > > [DbEnumerator (IDataReader, Boolean) > > Initializes a new instance of the DbEnumerator class using the > specified DataReader, and indicates whether to automatically close the > DataReader after iterating through its data.] > > So when the commandbehavior is set to closeconnection the second > parameter is set to true else is set to false ! > Ok the change should be in CVS now, thanks very much !!! -- Carlos Guzmán Álvarez Vigo-Spain http://carlosga.blogspot.com/ No hay un solo rey que no descienda de un esclavo, ni un esclavo que no haya tenido reyes en su familia. |