From: Jiri C. <di...@ci...> - 2007-08-29 16:31:34
|
On 8/29/07, alb...@ti... <alb...@ti...> wrote: > Hi, > using a version 2.1.0 RC-1 i have > some problem with a Dispose > method. > > Why throw this exception ? > "Invalid attempt of read when > the reader is closed." > > I create a FbCommand in this mode: > > private > static object executeQuery(DbConnection p_conn, string p_sql, hashtable > p_params) > { > DbCommand oc = null; > object res = DBNull.Value; > > if (p_conn.getType().Equals(typeOf(FbConnection)) ){ > oc = > new FbCommand(p_sql, (FbConnection)p_conn); > ... assign params > res = oc.ExecuteReader(); > > } > ...other > database connection type, such as Oracle, Sql Server... > > oc. > Dispose(); > > return res; > } > > I use the Dispose() method > because I see the memory of the > main process increase in exponential > mode. > > Sorry for my bad english. > > Thanks. > > Alberto > When you dispose connection, the connection is also closed. So then, you're not able to read domething from datareader. -- Jiri {x2} Cincura (Microsoft Student Partner) http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com |