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

出错

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);//这里出错
。。。。。
}

 

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

上一篇:利用Hibernate4注释生成表


下一篇:Kettle中预览SQL Server数据为乱码