解决"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="Data Source=./;Initial Catalog=DB;uid=User;pwd=Pwd;MultipleActiveResultSets=true;" providerName="System.Data.SqlClient"/>

posted @ 2011-12-21 18:37  Sphix  阅读(6937)  评论(1编辑  收藏  举报