Error when calling SqlTransaction.Rollback method

J

Jamie Schatte

We are running an ASP.NET 1.1 application that allows users to update data
in a SQL Server 2000 database. All of these updates follow the same general
flow as shown in the sample code below. This usually works great, but every
now and then the following exception is thrown when calling the Rollback
method:

"The SqlCommand is currently busy Open, Fetching"

I am not sure what is causing this exception. It seems like this is a
secondary exception that occurs during the Rollback, which means I am losing
the original exception that caused the Rollback to get called in the first
place.

Thanks in advance for any help.

Jamie Schatte
Fidelis Software

--------------------------------------- SAMPLE CODE
BELOW ----------------------------------------------

objSqlConnection.Open()
Try
objSqlTransaction = objSqlConnection.BeginTransaction
' ***** DO SOME SORT OF UPDATES HERE *****
objSqlTransaction.Commit()
Catch objException As Exception
objSqlTransaction.Rollback()
Throw objException
Finally
objSqlConnection.Close()
End Try
 
M

Marina

I've seen this when there was an open data reader on the same connection as
the transaction. If this is the case, you need to close the data reader
before rolling back the transaction.

To get the exception, just debug into your code, or alternatively,
temporarily remove the rollback code or place it in its own try catch.

In general though, it is a good idea to post relevant code with these types
of questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top