this topic is kind of big, but you need to use DTC (Distributed Transaction Coordinator), read some basics:transactional programming with .net
http://www.develop.com/summercamp/conferencedotnet/materials/X8.pdf

解决方案 »

  1.   

    使用COM+来完成多数据库的事务处理
      

  2.   

    刚好有一本WROX的新书是关于ASP.NET和分布式数据库方面的,不妨买来看看~
      

  3.   

    ADO.NET does not support distributed transactions involving multiple resource managers, you need to use DTC API, see
    Distributed Transactions Overview
    http://msdn.microsoft.com/library/en-us/cossdk/htm/pgdtc_dev_3lrn.asp?frame=true
      

  4.   

    http://www.htmchina.com/37/04/00075076,9.htm
    我的代码如下:生成DLL
    using System;
    using System.IO;
    using System.Data;
    using System.Data.OleDb;
    using System.EnterpriseServices;
    using System.Runtime.InteropServices;
    using System.Runtime.CompilerServices;
    using System.Reflection;namespace Canon.wwg.wwgB.batch
    { [Transaction(TransactionOption.Required)]
    public class DBOperation:ServicedComponent
    { private OleDbConnection myConnection;
    private OleDbCommand myCommand; /// <summary>
    /// connect database
    /// </summary>
    /// <param name=”connection”>database config infomation
    /// formatting : datasource=..;user id=..;password=...
    /// </param>
    /// <returns></returns>
    public void Connect(string connection)
    {

    myConnection = new OleDbConnection( connection );
    myConnection.Open(); myCommand = new OleDbCommand();
    myCommand.Connection = myConnection;

    return;
    } /// <summary>
    /// Execute one insert statement and insert one record into the table
    /// </summary>
    /// <param name=”connection”>database config infomation
    /// formatting : datasource=..;user id=..;password=...
    /// </param>
    /// <returns></returns> public int CommandExcute(string commandstring)
    { int returnValue = 0; myCommand.CommandText = commandstring;
    returnValue = myCommand.ExecuteNonQuery();

    return returnValue; } /// <summary>
    /// Commit the com+ transaction
    /// </summary> public void Commit()
    { ContextUtil.SetComplete(); if(myConnection!=null)
    myConnection.Close(); } /// <summary>
    /// Roolback the com+ transaction
    /// </summary> public void Abort()
    { ContextUtil.SetAbort(); if(myConnection!=null)
    myConnection.Close(); } }
    }
    在主文件中调用即可,注意要添加一个using System.EnterpriseServices;
      

  5.   

    如果是同一台服务器的多个库,打开一个连接,换库时用MyConnection.ChangeDatabase("AnotherDabaBase")就可以多个库做事务了,但多台服务器就没办法。
      大侠们提供的资料还没时间去看:(好像很难似的)
      这问题先呆着,过几天再来:)