Vladislav Panteleev wrote:
> But when I run the application and rise the function many 
> times per minute I've grtting "Timeout exceed" exception write on 
> conn.Open() method rising. I think this because of I havn't 
> close the connection and garbage collector do not clean the 
> memory quickly enought, but I can't to rise conn.Close()

You should never rely on the garbage collection to close database 
connections!

> before I return reader. So what should I do to solve this 
> problem?

If you pass CommandBehavior.CloseConnection to the ExecuteReader() 
method, then the FbDataReader will automatically close the connection 
when you call it's IDispose.Dispose method. So you can do something like 
this:

using(FbDataReader reader = getReader("blah"))
{
   // Use FbDataReader here
} // On this line, FbDataReader will automatically close the connection

Dean.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to