[已解決]There is already an open DataReader associated with this Connection which mu

今天程序報錯:There is already an open DataReader associated with this Connection which mu……

解決方案:在報錯方法之前使用了一個未釋放的IQueryable類型,

例如:dbContext.User.Where(x=>x.Age== 18);

需要釋放掉上面的DataReader,後面轉ToList()即可。

dbContext.User.Where(x=>x.Age== 18).ToList();

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章