其他分享
首页 > 其他分享> > There is already an open datareader associated with this command

There is already an open datareader associated with this command

作者:互联网

不关闭连接的情况下需要在ConnectionString中加上一个参数“MultipleActiveResultSets”, 将其值设置为true。

或者每次执行sql语句之后就关掉连接,每次使用再打开  使用using 可以把using里实例的对象在用完之后自动释放

using (MySqlConnection connection = new MySqlConnection(mysqlConnectStr)) { connection.Open(); return true; }

 

标签:already,associated,There,每次,connection,MySqlConnection,using,true,连接
来源: https://www.cnblogs.com/hgdhome/p/11676334.html