日期:2014-05-20  浏览次数:20904 次

删除记录再插入时出错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


我看了表,记录被删除了。

------解决方案--------------------
是不是插入的主键值重复了呢?