Using .net 2 and ADO.NET.
Is there a way to determine if a transaction is committed or not? The reason is that I’m stuck with a legacy framework that I cannot alter and there might or might not be an ambient transaction. Sometimes the ambient transaction is already committed causing the next database call to throw an exception and I need to know if it is or not.
Any pointers would be great!
Thanks
Johan
Check
Transaction.Current.TransactionInformation.Status. If it is anything other thanTransactionStatus.Active, you should not be using the current transaction.It goes without saying that you should check
Transaction.Currentfornullbefore taking its status.