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=true to the provider part of your connection string (where Data Source, Initial Catalog, etc. are specified).

http://msdn.microsoft.com/en-us/library/h32h3abf(v=vs.100).aspx

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

时间: 2024-10-29 08:37:22

error 'there is already an open datareader associated with this command which must be closed first'的相关文章

关于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 DataReader associated with this Command which must be closed first.,然后一般就会产生数据保存失败的异常. 解决方法是在ConnectionString中加上一个参数“MultipleActiveResultSets”, 将其值设置为tru

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." exception in EF 中 当我开启惰性加载情况下,系统会报此异常信息,出现此异常是发生于Sql server 2005. 解决方法:在数据库连接字符串中添加MARS信息为true <add name="CRGDatabase" connectionString

在实体对象中访问导航属性里的属性值出现异常“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”. public class User { public long UserId { get; set; } public string UserName { get; set; } public string UserPwd { get; set; } public D

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

[参考]There is already an open datareader associated with this command引发的问题 我在语句中并未使用 DataReader,未何也提示同样的错误,这个DataReader隐藏在哪里,我给大家在这里指出来,由于本人研究的还不够深入,只知道有一种方法的调用后会生成 DataReader,我想这也是绝大多数人遇到头疼的问题. 在使用数据库更新或插入语句时,大家通常使用 SqlCommand 的 ExecuteNonQuery() 方法,

EF There is already an open DataReader associated with this Command

捕捉到 System.InvalidOperationException _HResult=-2146233079 _message=意外的连接状态.在使用包装提供程序时,请确保在已包装的 DbConnection 上实现 StateChange 事件. HResult=-2146233079 解决参考: https://stackoverflow.com/questions/4867602/entity-framework-there-is-already-an-open-datareader

DbContext 查询(二)

接上一篇<DbContext 查询>. 对本地数据运行LINQ查询 由上篇博客可得知,Local属性返回的是内存中的数据集合,那使用LINQ to Object我们可以对这些数据运行查询. 查看一下示例:Example 2-21 1 private static void LocalLinqQueries() 2     { 3       using (var context = new BreakAwayContext()) 4       { 5         context.Dest

解决考试系统高并发数据载入不对问题

背景: 如今这版考试系统分为学生考试端和后台管理端.同一登陆页,学生输入学号.password进入考试界面,管理员输入username.password进入后台管理界面.平时没有学生考试时.后台管理界面学院下拉框能够正确的从数据库读取并载入数据,但有学生考试时.后台管理界面学院下拉框获取的数据有时为空,有时为脏数据. 我们所做的尝试: 1.再现数据载入不对场景 用LoadRunner压力測试程序模拟255人在线考试的过程,发现当考试人数达到50人时,后台管理界面開始出现上述数据载入不对问题. 2

解决考试系统高并发数据加载不正确问题

背景: 现在这版考试系统分为学生考试端和后台管理端.同一登陆页,学生输入学号.密码进入考试界面,管理员输入用户名.密码进入后台管理界面.平时没有学生考试时,后台管理界面学院下拉框可以正确的从数据库读取并加载数据,但有学生考试时,后台管理界面学院下拉框获取的数据有时为空,有时为脏数据. 我们所做的尝试: 1.再现数据加载不正确场景 用LoadRunner压力测试程序模拟255人在线考试的过程,发现当考试人数达到50人时,后台管理界面开始出现上述数据加载不正确问题. 2.验证数据库是否产生了死锁 我

在windows下运行docker的问题【Error getting IP address: ***】

环境配置系统:windows 10docker:Docker Toolbox https://www.docker.com/products/docker-toolbox 问题描述windows下安装完Docker Toolbox后运行Docker Quickstart Terminal可能会看到如下错误 Creating Machine default... Running pre-create checks... Creating machine... Error creating mach