我有一个代码:
MyDataClassesDataContext dc = new MyDataClassesDataContext();
Table<FormsAuthorisation> databaseAuthorisation = GetFormsAuthorisation();
Table<ADForm> databaseForms = GetADForm();
foreach (var auth in authorisation)
{
var databaseAuth = databaseAuthorisation.Where(p => p.GroupID == auth.GroupID && p.FormID == auth.FormID).FirstOrDefault();
databaseAuth.CanRead = auth.CanRead;
databaseAuth.CanWrite = auth.CanWrite;
dc.SubmitChanges();
}
foreach (var form in forms)
{
var databaseForm = databaseForms.Where(p => p.FormID == form.FormID).FirstOrDefault();
databaseForm.FormDescription = form.FormDescription;
dc.SubmitChanges();
}
dc.SubmitChanges();
此代码根本不保存任何更新的值。
google了很久但是没有好的结果
我所有的表都定义了主键。