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

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

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

  

There is already an open DataReader associated with this Command which must be closed first的更多相关文章

  1. There is already an open DataReader associated with this Command which must be closed first." exception in Entity Framework

    Fixing the "There is already an open DataReader associated with this Command which must be clos ...

  2. 在实体对象中访问导航属性里的属性值出现异常“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 ...

  3. 关于MultipleActiveResultSets属性导致的There is already an open DataReader associated with this Command which must be closed first的解决方法

    执行SqlDataReader.Read之后,如果还想用另一个SqlCommand执行Insert或者Update操作的话,会得到一个错误提示:There is already an open Dat ...

  4. 多线程下,多次操作数据库报错,There is already an open DataReader associated with this Command which must be closed first.

    原文:https://www.cnblogs.com/sdusrz/p/4433108.html 执行SqlDataReader.Read之后,如果还想用另一个SqlCommand执行Insert或者 ...

  5. error 'there is already an open datareader associated with this command which must be closed first'

    This can be easily solved by allowing MARS in your connection string. Add MultipleActiveResultSets=t ...

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

    使用MVC4 EF Linq获取foreach列表循环的时候遇到了如下的问题:报错提示 There is already an open DataReader associated with this ...

  7. C#.net mysql There is already an open datareader associated with this command引发的问题

    [参考]There is already an open datareader associated with this command引发的问题 我在语句中并未使用 DataReader,未何也提示 ...

  8. EF There is already an open DataReader associated with this Command

    捕捉到 System.InvalidOperationException _HResult=-2146233079 _message=意外的连接状态.在使用包装提供程序时,请确保在已包装的 DbCon ...

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

    废话不多说,直接 上图,及解决办法.不过问题还不是太清楚到底为什么会出现这个情况..........  

随机推荐

  1. 15-numpy笔记-莫烦pandas-3

    代码 import pandas as pd import numpy as np dates = pd.date_range('20130101', periods=6) df=pd.DataFra ...

  2. 【php】day01

    一.PHPCORE基础 1.什么是PHP:[Hypertext Preprocessor]            WEB程序开发语言,运行在服务器端                         的 ...

  3. [LeetCode] 719. Find K-th Smallest Pair Distance 找第K小的数对儿距离

    Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pai ...

  4. 这篇文章主要讲解C#中的泛型,泛型在C#中有很重要的地位,尤其是在搭建项目框架的时候。

    一.什么是泛型 泛型是C#2.0推出的新语法,不是语法糖,而是2.0由框架升级提供的功能. 我们在编程程序时,经常会遇到功能非常相似的模块,只是它们处理的数据不一样.但我们没有办法,只能分别写多个方法 ...

  5. 文件夹如何添加备注(保证可以WIN7 WIN10测试通过)

    网上很多方法都有人说试过了,不可以.其实不是不可以,他们都没有说完整 今天自己弄了下,弄出来了,废话不多说先上图 如果需要用备注排序,那么就需要把排序的选项加上备注的分类 1.获得desktop.in ...

  6. android 模拟输入框edittext控件按下回车或扫描头扫描到条码

    edtScan.setText(result); edtScan.onEditorAction(EditorInfo.IME_ACTION_NEXT); 场景:PDA都有扫描头,但有时想用自己的手机来 ...

  7. 用Autofac替换.net core 内置容器

    官方建议使用内置容器,但有些功能并不支持,如下: 属性注入 基于名称的注入 子容器 自定义生存期管理 Func<T> 支持 所以可以使用其他第三方IOC容器,如Autofac,下面为学习使 ...

  8. 查看linux中某个端口port是否被利用

    (1)lsof -i:端口号查看某个端口是否被占用 (2)netstat -an|grep 80 netstat -- show network status (3)杀掉进程 kill pid 注意: ...

  9. 三大类sql语句——该记录是本人以前微博上的文章

    一.DML语句二.DDL语句三.事务控制语句一.DML语句-Data Mulipulation LanguageDML语句数据操作野菊执行后会生成一个事务,事务需要提交才能够永久生效,在commit前 ...

  10. OpenShift下的JVM监控

    去年写过一篇基于jmx监控的文章,这次在Openshift上实现,发现确实不少变化.主要重点问题在 1. prometheus jmx exporter的改进,不再需要运行一个独立的进程,不需要把数据 ...