var queryResult = this.kindergardenDataContext.Groups.Where(g => g.group_id == groupToAdd.group_id && g.group_enabled==true);
if (queryResult != null && queryResult.Count() != 0)
{
Group groupToEdit = queryResult.First();
groupToEdit.group_name = groupToAdd.group_name;
groupToEdit.group_create_date = groupToAdd.group_create_date;
groupToEdit.Kindergarden = groupToAdd.Kindergarden;
groupToEdit.GroupGuardian = groupToAdd.GroupGuardian;
groupToEdit.Room = groupToAdd.Room;
}
this.kindergardenDataContext.SubmitChanges();
你好。我是 LINQ 的初学者。这里没问题,但是 foreigns 键 kindergarden、groupguardian、room 已在数据库中重复(在 kindergarden、groupguardian、room 表中的数据库中添加了新行)。如何设置好的参考来更新组表中的行。