Home All Groups Group Topic Archive Search About

Transaction Problem after upgrading ASP.Net + C# App. from .Net 2.0 beta to .Net 2.0 Professional

Author
16 Nov 2005 7:43 AM
Beenz
Hello,
I am developing an application in C#, which was previously in .Net 2005
Beta, then it was working perfectly fine, but from the time I have
upgraded
it to .Net 2.0 Professional, its continously giving me error on the
following line,
transaction  = Connection.BeginTransaction();

System.Data.SqlClient.SqlException: New transaction is not allowed
because
there are other threads running in the session.
   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(TdsParserStateO
bject
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(T
ransactionRequest
transactionRequest, String transactionName, IsolationLevel iso,
SqlInternalTransaction internalTransaction)
   at
System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(Transa
ctionRequest
transactionRequest, String name, IsolationLevel iso,
SqlInternalTransaction
internalTransaction)
   at
System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(Isolatio
nLevel
iso, String transactionName)
   at
System.Data.SqlClient.SqlInternalConnection.BeginTransaction(IsolationLe
vel
iso)
   at
System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel
isolationLevel)
   at
System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransacti
on()

I removed Beta using a Microsoft provided utility. This same project is
running on another machine and giving the very same error. I am logged
in as
admin. and all kind of settings are perfectly fine.
The problem with this error is that its occuring on some actions, while
on
others application works fine. Initially some actions works perfectly
fine but if once this error starts coming on that particular location,
its keep on coming exactly on the same location, reboot don't have any
effect on this.
Multiple Active Results sets is on.
This error has made our application extremely unstable. quick help will
be appreciated.

Beenish Sahar Khan,
Software Developer,
Kolachi Advanced Technologies

*** Sent via Developersdex http://www.developersdex.com ***

Author
16 Nov 2005 10:04 AM
Kevin Yu [MSFT]
Hi Beenz,

Are your starting a new transaction when a DataReader is left open?

This is by-design. In order to avoid non-determinite transactional state,
there must be no open operations while executing a transaction change. To
allow this would be to allow indeterminite state. You wouldn't know what
operations were part of of the transaction or not. This was changed recent
builds and the RTM build.

So, please close the reader and start the transaction. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Author
16 Nov 2005 10:41 AM
Beenish Sahar Khan
Guys, it worked :)
Thanks Kevin.

Show quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
news:Yz0NZUp6FHA.3036@TK2MSFTNGXA02.phx.gbl...
> Hi Beenz,
>
> Are your starting a new transaction when a DataReader is left open?
>
> This is by-design. In order to avoid non-determinite transactional state,
> there must be no open operations while executing a transaction change. To
> allow this would be to allow indeterminite state. You wouldn't know what
> operations were part of of the transaction or not. This was changed recent
> builds and the RTM build.
>
> So, please close the reader and start the transaction. HTH.
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>
Author
16 Nov 2005 10:43 AM
Beenish Sahar Khan
Dear Kevin,

Hello,

Thanks very much, your answer was quite right and solved our problem. I am
really thankfull to you. Btw. Just a compliment, you guys are doing a great
job, two thumbs up to you ppl (Y) Regards, Beenish Sahar Khan

Show quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
news:Yz0NZUp6FHA.3036@TK2MSFTNGXA02.phx.gbl...
> Hi Beenz,
>
> Are your starting a new transaction when a DataReader is left open?
>
> This is by-design. In order to avoid non-determinite transactional state,
> there must be no open operations while executing a transaction change. To
> allow this would be to allow indeterminite state. You wouldn't know what
> operations were part of of the transaction or not. This was changed recent
> builds and the RTM build.
>
> So, please close the reader and start the transaction. HTH.
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>
Author
17 Nov 2005 1:32 AM
Kevin Yu [MSFT]
You're welcome, Beenish. It was nice to know that you have had the problem
resolved.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

AddThis Social Bookmark Button