views:

55

answers:

1

I have a method that has a connection as one of it's parameters:

e.g. public void Foo(SqlConnection pConn) { }

within Foo is it possible to determine if pConn is enlisted in any transactionscope?

A: 

If its sql server issue a select @@trancount would be one way

Andrew
I don't think this will work unless you execute it on from within the connection that's supposed to be attached to the transaction. If, for example, while you have a break-pointed code in the middle of a transaction, and you do 'select @@trancount' in SSMS, it'll return 0.
Yoopergeek

related questions