我Student
使用以下代码获得了表的主键:
var stud_id = (from p in context.Students
where p.Student_Name == "Bruce"
select p.Student_Id );
当我尝试使用stud_id
以下代码检索整个实体时:
Student requiredstud = new Student();
foreach (var p in stud_id)
{
//Console.WriteLine(p);
requiredObj = context.Students.Find(p);
string tempObj = JsonSerializer.SerializeToString<Student>(requiredObj);
Console.WriteLine(tempObj);
}
它在线上给出了以下异常:
requiredObj = context.Students.Find(p);
如何解决此问题并获取详细信息student
编辑: 内部异常
是:{"There is already an open DataReader associated with this Command which must be closed first."}