SQL Server 2005/ ADO.NET 2.0 Begin Transaction Issue

I have an application that was originally built in VS 2003 and was successfully
running against SQL Server 2000 and SQL Server 2005 (June CTP). Recently, we
migrated to VS 2005 Beta 2 and are running on SQL Server 2005 (June CTP)
exclusively. Since the migration, we have some situations where we receive
the following exception when attempting to begin a SQLTransaction:

Exception Type: System.Data.SqlClient.SqlException
Number: 3988
Message: New transaction is not allowed because there are other threads
running in the session

Stack Trace:

StackTrace Information

*********************************************
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject stateObj)
at
System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[]
buffer, TransactionManagerRequestType request, String transactionName,
TransactionManagerIsolationLevel isoLevel, Int32 timeout,
SqlInternalTransaction transaction, TdsParserStateObject stateObj)
at
System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest
transactionRequest, String transactionName, IsolationLevel iso,
SqlInternalTransaction internalTransaction)
at
System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest
transactionRequest, String name, IsolationLevel iso, SqlInternalTransaction
internalTransaction)
at
System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName)
at System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel
iso, String transactionName)
at System.Data.SqlClient.SqlConnection.BeginTransaction()
I haven't been able to find any information about this error and I was
wondering if anyone had ideas about the cause of the exception and why it is
an issue with VS 2005 Beta 2 but not in VS 2003.

Regards,

Robert Kihm

[2441 byte] By [RobertKihm] at [2008-2-24]
# 1

It's very likely that you have an opened data reader associated with the connection. You need to make sure it's closed before you start a new transaction.

The change is by-design. The request of a transaction should be the only request when you execute a transaction.

BillLin-MSFT at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 2

Hi,

I got the same error and i am not using any datareader in my whole project and stack trace is also giving the error related to datareader. most importantly the error is not occuring very often.

Please help!!!!

System.Data.SqlClient.SqlException: New request is not allowed to start because it should come with valid transaction descriptor.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

Warm Regards,

Imtiyaz

ImtiyazThange at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Tools General...

SQL Server

Site Classified