DataReader 未关闭时出错

发布于 2024-09-25 08:18:20 字数 261 浏览 0 评论 0原文

任何人都可以帮助我解决此错误是如何出现的

已经有一个与此连接关联的打开的 DataReader 必须首先关闭。

当尝试读取此代码时,错误失败。

transConn = mySqlConn.BeginTransaction(IsolationLevel.ReadCommitted)

Datareader 和初始化事务之间是否有联系?

谁能帮我解决这个错误。

谢谢偷看! :)

Can anyone help me on how this error came up

There is already an open DataReader associated with this Connection which must be closed first.

the error fails when it trying to read this code.

transConn = mySqlConn.BeginTransaction(IsolationLevel.ReadCommitted)

Is there is a connection between the Datareader and in initializing the transaction?

Can anyone help me on how can I fix this bugs.

Thanks peeps! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞清仓 2024-10-02 08:18:20

在开始事务之前关闭 DataReader。

请参阅此处:http://msdn.microsoft。 com/en-us/library/system.data.sqlclient.sqldatareader.close.aspx

它说:

“当您使用 SqlDataReader 将关联的 SqlConnection 用于任何其他目的时,必须显式调用 Close 方法”。

Close the DataReader before you begin the transaction.

See here: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.close.aspx

It says:

"You must explicitly call the Close method when you are through using the SqlDataReader to use the associated SqlConnection for any other purpose."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文