DataReader 未关闭时出错
任何人都可以帮助我解决此错误是如何出现的
已经有一个与此连接关联的打开的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在开始事务之前关闭 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."