Question

Short: After a call to transaction.Commit(), the next operation fails as if the transaction was not committed.

More details: We have a thread running write queries to the database, some of which are encapsulated in a transaction. When running heavier load after a while we encounter a situation where the operation after committing a transaction fails with an error indicating that a transaction is in progress, depending on the action performed after the commit we receive one of the following errors:

next operation is 'begin transaction:

...Connection does not support parallel transactions...

next operation is insert/update/delete

ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.

Inspecting the Sql Connection object through the debugger shows that it contains an 'sqlInnerTransaction' object with it's parent set to null. We do know that the call to 'Commit' completed successfully without an error.
Running .net 4.0, SQL Server 2008 R2 SP2

Was it helpful?

Solution

Looking at this message:

Connection does not support parallel transactions

I wonder if you are using a single connection object in multiple threads?

Connections are not thread-safe. You should only use them in the thread on which they were created.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top