Q:

How do I check if System.Data.SqlClient.SqlTransaction has an active transaction?

I have a method which I use to execute all my SQL queries (inserts, updates, delete) and I want to put a check in to make sure the change is within a transaction before the code is executed but I can't find a property against the SqlTransaction to check for.
How should I proceed?
Note: I am using FDBConnection.BeginTransaction("MY_TRANS"); to begin the transaction and standard rollback and commnit methods
Using .NET 4.0 with VS 2010 Web Dev Express.

A:

if your db is SQL server, @@TRANCOUNT shows # of active transactions in the connection in context
Select @@TRANCOUNT

if other db , please specify
HTH

