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
{
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>
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