简体   繁体   中英

Error with OLEDB provider New transaction cannot enlist in the specified transaction coordinator

    using (TransactionScope transactionscope = new TransactionScope())
    {
     try
        {
            function1(); //perform update on table
            function2(); //perform update on table 
            transactionscope.Complete();
        }
        catch(Exception ex)
        {

        }
     }

Code working fine with sqlclient provider but in case of oledb provider it gives error "New transaction cannot enlist in the specified transaction coordinator". Already enable DTC service on server.

在此输入图像描述

您无法在多个事务中打开连接,因此创建连接对象并在事务范围之外将其打开存储在会话中重用它在事务中所需的位置,事务完成后确保关闭连接以避免任何问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM