At 07:48 PM 11/03/2010, Krzysztof Jeske wrote: >Thanks. > >But there is another problem. What if I want to create table "test" and fill >it with data in one transaction? > >If I do: > >using (var connection = this.CreateConnection()) >using (var transaction = connection.BeginTransaction()) >using (var command = connection.CreateCommand()) >{ > command.Transaction = transaction; > > command.CommandText = "CREATE TABLE Test (ID INTEGER NOT NULL);"; > command.ExecuteNonQuery(); > > command.CommandText = "INSERT INTO Test (ID) VALUES (1);"; > command.ExecuteNonQuery(); // ## here is thrown an exception > > transaction.Rollback(); // rollback for testing >} > >I receive an exception: >SQL error code = -204 >Table unknown >TEST > >What can I do? These two operations (create and insert) have to be in one >transaction.
They cannot be in one transaction, by design (and it has nothing to do with .NET Provider). It is simply NOT allowed to insert rows into a table that is uncommitted. This is completely by design. The reason is that the Firebird engine itself has several operations to perform, including DML involving the system tables, that do not begin until your DDL request is committed. *Never* mix DDL and user DML in a single transaction. Period. Helen ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider