SCMQuoteParityEntry data = null;
data= scmConetxt.SCMQuoteParityEntry.Where(i => i.Id == id).SingleOrDefault();
SCMQuoteParity scm = new SCMQuoteParity() { Id=Convert.ToInt32( data.SCMQuoteParityId)};
scmConetxt.SCMQuoteParity.Remove(scm);
scmConetxt.SCMQuoteParityEntry.Remove(scmConetxt.SCMQuoteParityEntry.Find(id));
scmConetxt.SaveChanges();代碼如上,我想點擊刪除同時刪掉兩個表里的數據,兩個表有字段關聯。上面的代碼報錯 The object cannot be deleted because it was not found in the ObjectStateManager.小白求救沒怎么接觸過ef
- 1 回答
- 0 關注
- 837 瀏覽
添加回答
舉報
0/150
提交
取消