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",

  

转载于:https://www.cnblogs.com/zitjubiz/p/10999560.html

你可能感兴趣的:(There is already an open DataReader associated with this Command which must be closed first)