以下简化代码不起作用(因为它将检索到的对象引用设置为参数),但它显示了我想要执行的操作
public bool updateEvent(clubEvent newEvent)
{
TNightCon tCon = new TNightCon();
clubEvent cEv = (from cEvent in tCon.clubEvents
where cEvent.EventID == newEvent.EventID
select cEvent).First();
// Won't work, but do I have to set all the fields manually?
cEv = newEvent;
tCon.SubmitChanges();
return true;
}
最佳答案
或者,交替地,
tCon.ClubEvents.DeleteOnSubmit(cEv);
tCon.CLubEvents.InsertOnSubmit(newEvent);
tCon.SubmitChanges();
关于c# - 使用 recordType 的对象更新 Linq2Sql 中的记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/752303/