Hi,

I have in sql script 30 lines of SQL code. When I execute this script and I 
got an error on 24th line I have to rollback previous changes (23 lines). So 
I write code:

FbConnection c = new 
FbConnection(@"Database=employee.fdb;User=SYSDBA;Password=masterkey");
c.Open();

using (FbTransaction tr = c.BeginTransaction())
{
    try
    {
        FbBatchExecution fbe = new FbBatchExecution(c);
        foreach (string cmd in script.Results)
        {
           fbe.SqlStatements.Add(cmd);
        }

        fbe.Execute(false);
        tr.Commit();
    }
    catch(Exception)
    {
        tr.Rollback();
        throw;
    }
}

c.Close();

After executing I get an error:
Batch execution aborted. The returned message was: Execute requires the 
Command object to have a Transaction object when
the Connection object assigned to the comm...

So, what I have to do to make my code working?

Regards,
Chris 


------------------------------------------------------------------------------
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

Reply via email to