其他分享
首页 > 其他分享> > There is already an open DataReader associated with this Command which must be closed first

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

作者:互联网

通常出现在嵌套查询数据库(比如在一个qry的遍历时,又进行了数据库查询)

通过在连接字符串中允许MARS可以轻松解决这个问题。 将MultipleActiveResultSets = true添加到连接字符串的提供程序部分

    "SqlServerConnection": "Server=.\\sqlexpress;Database=test;Integrated Security=True;Connect Timeout=15;MultipleActiveResultSets=true",

  

标签:already,associated,There,MultipleActiveResultSets,字符串,true,连接
来源: https://www.cnblogs.com/zitjubiz/p/10999560.html