Implementing transactions over multiple databases

Solution 1:

Use the TransactionScope class like this:

using (TransactionScope ts = new TransactionScope())
{
    //all db code here

    // if an error occurs jump out of the using block and it will dispose and rollback

    ts.Complete();
}

The TransactionScope class will automatically convert to a distributed transaction if necessary.

Solution 2:

Using transactionScope is the answer. It even works with different DBMS!!!

Transactions over multiple databases