Hi Bob:

Thanks for the info. Used your first suggestion and it works quite nicely.

thanks, Greg



On Wed, 24 Apr 2002 11:48:27 -0700, Beauchemin, Bob <[EMAIL PROTECTED]>
wrote:

>I'm assuming that you are using SQL Server....
>
>This is a known problem and I'd heard it might be fixed in next release.
Until then:
>
>1. Bracket the Transaction.Rollback or Transaction.Commit in a try catch
block and ignore the error.
>2. Run the command "SELECT @@TRANCOUNT" to see if you still have an active
transaction (>0) or not (=0) before attempting to commit or rollback.
>
>Hope this helps,
>Bob Beauchemin
>[EMAIL PROTECTED]
>
>
>-----Original Message-----
>From: Greg Gates [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, April 24, 2002 1:16 PM
>To: [EMAIL PROTECTED]
>Subject: [DOTNET] Transaction rollback
>
>
>Hi everyone:
>
>I have a method that executes a batch of stored procedures wrapped in an
>ADO.NET transaction.
>
>Naturally I rollback the transaction if an exception occurs.
>
>However, an exception can occur in the catch block if a transaction
>rollback has already occurred in the database.
>(in this case, the origin is a trigger that raises an error and rolls back
>the transaction in certain circumstances).
>
>This makes sense to me as the code is trying to rollback a transaction that
>has already been rolled back.
>
>
>Is it possible to determine the state of the transaction from code? In my
>exception code I would like to check if there is an open transaction before
>attempting to do a rollback.
>
>
>thanks, Greg
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to