今天程序報錯: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();
今天程序報錯: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();