views:

190

answers:

1

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

+2  A: 

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.

Shiraz Bhaiji
This differs based on SQL2005 and SQL2008 - but +1 as it is worth bearing in mind. SQL2008 can handle the second connection without promoting to MS DTC.
Sohnee
@Sohnee, Thanks for the comment. Yet another reason to switch to SQL Server 2008.
Shiraz Bhaiji