views:

26

answers:

1

Hi

I have a MVC app that uses Linq2Sql to access a SQL DB. But I want create a distributed transaction to update another DB on different local server.

I want to update both in a transaction.

Can I just wrap logic in TransactionScope class???

Malcolm

A: 

If your database supports using TransactionScope (Informix seems to want to use IfxTransactions) then you should be able to use the transaction across multiple databases.

You can open multiple database connections within the same transaction scope. The transaction scope decides whether to create a local transaction or a distributed transaction.

The transaction scope automatically promotes a local transaction to a distributed transaction if necessary, see this article for more details: http://www.csharpcorner.com/uploadfile/mosessaur/transactionscope04142006103850am/transactionscope.aspx

Lerxst