sách gpt4 ăn đã đi

c# - 开始事务时出现 SqlServer.Management.SMO.Server 错误

In lại 作者:太空狗 更新时间:2023-10-29 22:53:36 25 4
mua khóa gpt4 giày nike

使用 SMO 时出错。此代码一直在 VB.Net 4 中运行,并且刚刚移至 C#,现在无法运行。

Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(
new Microsoft.SqlServer.Management.Common.ServerConnection(
new System.Data.SqlClient.SqlConnection(connStr.ToString())));

server.ConnectionContext.Connect();
server.ConnectionContext.BeginTransaction(); // error here

错误是:

A transaction that was started in a MARS batch is still active at the end of the batch. The transaction is rolled back.

除了 SMO 之外,没有与数据库的其他连接。

连接字符串是:

Data Source=MYPC\SqlServer;Initial Catalog=mytestdb;Integrated Security=True;User ID=;Password=;MultipleActiveResultSets=True

有没有人在使用 SMO 时看到过这个错误并且知道是什么原因造成的?

câu trả lời hay nhất

从连接字符串中删除 MARS 解决了问题。

关于c# - 开始事务时出现 SqlServer.Management.SMO.Server 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9744089/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress