这是我的代码
using (BatchDashboardDataContext db = new BatchDashboardDataContext())
{
TBatchDashboard b = new TBatchDashboard();
b.Id = deletedBatchId;
db.TBatchDashboards.Attach(b);
db.TBatchDashboards.DeleteOnSubmit(b);
db.SubmitChanges();
}
id 是TBatchDashboard
表的主键。还有一条记录具有deletedBatchId
作为表中主键的值TBatchDashboard
。请检查它给我建议。谢谢。