我没有插入......主键不是身份,自动生成的值设置为false......有什么想法吗?
var x= dataAccessDataContext.XTable.FirstOrDefault(xt=> xt.ID == Convert.ToInt32(id));
if (x==null)
{
var newX = new Xtable
{
Data=id
};
dataAccessDataContext.XTable.InsertOnSubmit(newX);
dataAccessDataContext.SubmitChanges();
}
else
{
x.Data=id
dataAccessDataContext.SubmitChanges();//error happens right here when updating
}