System.InvalidOperationException:“This MySqlConnection is already in use. See https://fl.vu/mysql-co

出错

var applicationform = db.ApplicationForm.Where(x => applicationformids.Contains(x.id));
            foreach (var item in applicationform)
            {
    var supply = realNeedApplyList.Single(x => x.applicationformid == item.id);//这里出错
。。。。。
}

解决办法加.ToList()

var applicationform = db.ApplicationForm.Where(x => applicationformids.Contains(x.id));
            foreach (var item in applicationform.ToList())
            {
    var supply = realNeedApplyList.Single(x => x.applicationformid == item.id);//这里出错
。。。。。
}

 

上一篇:SAPUI5 Walkthrough Step 19: Reuse Dialogs


下一篇:LINQ to SQL 数据库连接