请参阅以下内容:
Using scope As New System.Transactions.TransactionScope
//Create instance of connection 1 and open
//Create instance of connection 2 and open
//Create instance of connection 3 and open
scope.complete()
End Using
有没有办法从交易中排除连接2。原因是connection2连接的数据库服务器没有启用事务。我打算启用它,但它必须经历“变更过程”,这需要数周时间。因此,我正在寻找一个快速的胜利。
答案 0 :(得分:1)
您只需在交易前创建第二个连接:
//Create instance of connection 2 and open
Using scope As New System.Transactions.TransactionScope
//Create instance of connection 1 and open
//Create instance of connection 3 and open
scope.complete()
End Using