Subject | Working with transactions |
---|---|
Author | Russell Rose |
Post date | 2012-04-03T15:20:02Z |
I was wondering if there was any way to determine if there is a pending transaction outstanding. I have a single connection to a database and have something like the following code:
FbConnection conn;
FBCommand cmd = conn.CreateCommand();;
cmd.Transaction = conn.BeginTransaction();
I then call another generic routine which starts up a new command:
Cmd2 = conn.CreateCommand();
I get the following error:
Execute requires the Command object to have a Transaction object when the Connection object assigned to the command is in a pending local transaction. The Transaction property of the Command has not been initialized.
The 2nd routine is sometimes called when there is a pending transaction and sometimes not.
[Non-text portions of this message have been removed]
FbConnection conn;
FBCommand cmd = conn.CreateCommand();;
cmd.Transaction = conn.BeginTransaction();
I then call another generic routine which starts up a new command:
Cmd2 = conn.CreateCommand();
I get the following error:
Execute requires the Command object to have a Transaction object when the Connection object assigned to the command is in a pending local transaction. The Transaction property of the Command has not been initialized.
The 2nd routine is sometimes called when there is a pending transaction and sometimes not.
[Non-text portions of this message have been removed]