theoforce 发表于 2019-1-27 10:20:29

There is already an open DataReader associated with this Connection which must b

使用MVC4 EF Linq获取foreach列表循环的时候遇到了如下的问题:报错提示
There is already an open DataReader associated with this Connection which must be closed first
http://s3.运维网.com/wyfs02/M02/22/D8/wKiom1MpUKahMBJWAANPPFMDiAs141.jpg解决方法如下红色所示:
@foreach (var item in Model.ToList())
{
@Html.ActionLink(@item.user.nickname + "(微信)", "../Mess/MessInfo", new { id = item.id })
}
将Model改成Model.ToList()的就ok了






页: [1]
查看完整版本: There is already an open DataReader associated with this Connection which must b