Search code examples
c#asp.nettransactionscopetableadaptertyped-dataset

Transaction handling with TransactionScope


I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx

I just want to confirm that is there any issue when using TransactionScope with Tableadapters?

I have read this article and read some issues with this, but the article was 2.5 years old http://blog.falafel.com/2007/04/09/GettingTableAdaptersToParticipateInTransactions.aspx

I hope in latest version of .Net Framework, the issue has been resolved

I am using .Net framework 3.5 version

Thanks


Solution

  • I do not thing that the article is 100% correct.

    Transaction scope will automatically change the transaction to a distributed transaction if you connect to more than one database or connect to a single database with more than one connection.

    The code that the article writer is using is generating more than one connection to the database. It is therefore trying to use MS DTC (the distributed transaction coordinator), if this is not set up correctly the transaction will fail.

    We use Transaction Scope everywhere we need a transaction, whenever we have had a problem it has been due to our code or configuration.