using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Data.SqlClient;
using System.Data.OleDb;
using System.Transactions;

public partial class DistributedTransaction : System.Web.UI.Page
{
   protected void Page_Load(object sender, EventArgs e)
   {
      string connStrngA = ConfigurationManager.ConnectionStrings["BookCatalog"].ConnectionString;
      string connStrngB = ConfigurationManager.ConnectionStrings["Customers"].ConnectionString;

      bool isConsistant = false;
      using (TransactionScope scope = new TransactionScope())
      {
         // open connection to SQL database. The scope will initially be local
         using (SqlConnection connA = new SqlConnection(connStrngA))
         {
            // use this connection
         }


         // open connection to Access database, which will change 
         // transaction to distributed scope
         using (SqlConnection connB = new SqlConnection(connStrngB))
         {
            // use this connection

            // all done 
            isConsistant = true;
         }

         // commit all transactions within this scope
         if (isConsistant)
            scope.Complete();
      }
   }
}
