From:
<car...@te...> - 2004-04-15 21:29:34
|
Hello: >The following code throws an error: > >FbCommand cmd = null; >try { >FbConnection connection = new Connection(_connString); >cmd = connection.CreateCommand(); >cmd.CommandText = selectstring; >reader = cmd.ExecuteReader(); >} >catch (Exception ) {} >finally { > if(cmd!=null) > cmd.Dispose(); >} > > I have a fix in my local tree yet, but that code is not correct ;) can you try with this: FbConnection connection = new FbConnection(connectionString); FbCommand cmd = null; FbDataReader reader = null; try { connection.Open(); cmd = connection.CreateCommand(); cmd.CommandText = "SELECT * FROM tableName"; reader = cmd.ExecuteReader(); } catch (Exception) {} finally { if (reader != null) { reader.Close(); } if (cmd != null) { cmd.Dispose(); } connection.Close(); } -- Best regards Carlos Guzmán Álvarez Vigo-Spain |