From: Abel E. P. <a1...@al...> - 2004-01-31 02:00:32
|
Greetings, > IDbConnection cn = new FirebirdSql.Data.Firebird.FbConnection(conString) ; > > cn.Open() ; > > IDbCommand dbcmd = cn.CreateCommand() ; > > dbcmd.CommandText="select * from mcust" ; > > Console.WriteLine(cn.State.ToString()); // gives back OPEN > > dbcmd.ExecuteReader() ; // <---------- Here it crashes!!! error: Command > must have a valid transaction From the documentation provided with Firebird .NET Data Provider: ... FbConnection connection = new FbConnection(connectionString); connection.Open(); -> FbTransaction transaction = connection.BeginTransaction(); string insertQuery = "INSERT INTO PROJECT(proj_id, proj_name, product) Values('FBNP', '.NET Provider', 'N/A')"; FbCommand command = new FbCommand(insertQuery, myConn, myTxn); command.ExecuteNonQuery(); transaction.Commit(); connection.Close(); ... You're simple missing a transaction for the command, check line 3 Regards, Abel Eduardo Pereira |