删除记录再插入时出错Cannot add an entity with a key that is already in use
dc.TongJi_Qis.DeleteAllOnSubmit(v);
dc.SubmitChanges();
后
dc.TongJi_Qi_JiBens.InsertOnSubmit(xx);
dc.SubmitChanges();//出错
Cannot add an entity with a key that is already in use
我看了表,记录被删除了。
------解决方案--------------------
是不是插入的主键值重复了呢?