Hi all, 

I think that I must be doing something wrong - when I run the code shown
below I get an exception thrown on the line "batch.Execute(false);".  

using (FbConnection connection = new FbConnection(connectionString))
{
    connection.Open();
    using (FbTransaction transaction = connection.BeginTransaction())
    {
        FbBatchExecution batch = new FbBatchExecution(connection);

        try
        {
            batch.SqlStatements.Add("INSERT INTO MY_TABLE (MY_FIELD)
VALUES(1);");
            batch.SqlStatements.Add("INSERT INTO MY_TABLE (MY_FIELD)
VALUES(2);");
            batch.SqlStatements.Add("INSERT INTO MY_TABLE (MY_FIELD)
VALUES(3);");
            batch.SqlStatements.Add("INSERT INTO MY_TABLE (MY_FIELD)
VALUES(4);");
            batch.Execute(false);
            transaction.Commit();
        }
        catch (Exception e)
        {
            throw e;
        }
    }
}

The exception that is thrown contains the message "A transaction is
currently active. Parallel transactions are not supported.", so the question
is how can I register a transaction to use with the FbBatchExecution class?

Thanks
Gareth
-- 
View this message in context: 
http://firebird.1100200.n4.nabble.com/Exception-thrown-when-using-transactions-and-FbBatchExecution-tp2336286p2336286.html
Sent from the firebird-net-provider mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to