An error occurred while starting a transaction on the provider connection. See the inner exception f...

用EntityFramework循环操作数据时,报了如下错误 

An error occurred while starting a transaction on the provider connection. See the inner exception for details.
System.InvalidOperationException: 已有打开的与此 Command 相关联的 DataReader,必须首先将它关闭。

查询了资料  https://www.cnblogs.com/dongshuangjie/p/4832100.html

发现犯了个 低级错误,

千万不要在Iqueryable查询句子里面嵌套saveChange。  Iqueryable与Ilist的区别不再啰嗦。

转载于:https://www.cnblogs.com/taoshengyujiu/p/11039410.html

猜你喜欢

转载自blog.csdn.net/weixin_33736832/article/details/93828897