TransactionScope - 不包括连接

时间:2013-10-30 11:44:50

标签: vb.net

请参阅以下内容:

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连接的数据库服务器没有启用事务。我打算启用它,但它必须经历“变更过程”,这需要数周时间。因此,我正在寻找一个快速的胜利。

1 个答案:

答案 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