使用MVC4 EF Linq获取foreach列表循环的时候遇到了如下的问题:报错提示 There is already an open DataReader associated with this Connection which must be closed first 解决方法如下红色所示: @foreach (var item in Model.ToList()) {   @Html.ActionLink(@item.user.nickname + "(微信)", "…
废话不多说,直接 上图,及解决办法.不过问题还不是太清楚到底为什么会出现这个情况..........  …
Fixing the "There is already an open DataReader associated with this Command which must be closed first." exception in Entity Framework 下面代码可能会报如标题所示错误 var contacts = from c in db.Contact select c; foreach (Contact c in contacts) { if (c.Phones.…
在实体对象中访问导航属性里的属性值出现异常“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…
执行SqlDataReader.Read之后,如果还想用另一个SqlCommand执行Insert或者Update操作的话,会得到一个错误提示:There is already an open DataReader associated with this Command which must be closed first.,然后一般就会产生数据保存失败的异常. 解决方法是在ConnectionString中加上一个参数“MultipleActiveResultSets”, 将其值设置为tru…
原文:https://www.cnblogs.com/sdusrz/p/4433108.html 执行SqlDataReader.Read之后,如果还想用另一个SqlCommand执行Insert或者Update操作的话,会得到一个错误提示:There is already an open DataReader associated with this Command which must be closed first.,然后一般就会产生数据保存失败的异常. 解决方法是在ConnectionS…
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/h…
通常出现在嵌套查询数据库(比如在一个qry的遍历时,又进行了数据库查询) 通过在连接字符串中允许MARS可以轻松解决这个问题. 将MultipleActiveResultSets = true添加到连接字符串的提供程序部分 "SqlServerConnection": "Server=.\\sqlexpress;Database=test;Integrated Security=True;Connect Timeout=15;MultipleActiveResultSets=…
为了压系统,昨天小组在测试环境模拟了一大批订单数据.今天上午查看记录的账单计息日志,发现了一大堆的MySqlException MySql.Data.MySqlClient.MySqlException (0x80004005): There is already an open DataReader associated with this Connection which must be closed first. 诸如: 2017-01-05 00:40:49.891 账单计息异常/{"B…
“System.NotSupportedException”类型的未经处理的异常在 Microsoft.Data.Services.Client.dll 中发生 其他信息: 对此 POST 请求的响应未包含“location”标头.此客户端不支持这种做法. 未处理System.NotSupportedException  HResult=-2146233067  Message=对此 POST 请求的响应未包含“location”标头.此客户端不支持这种做法.  Source=Microsoft…