c# - Linq to Sql Update on extracted list not working -
i having issues updating database using linq sql. have master query retrieves records in database (16,000 records)
postdatacontext ctxpost = new postdatacontext(); int n = 0; var d = (from c in ctxpost.pwc_gs c.status == 1 select c);
i take first 1000, , pass to object after modification using following query:
var cr = d.skip(n).take(1000);
i loop through records using foreach loop
foreach (var _d in cr) { // stuffs here _d.status = 0; }
i call submitchanges
ctxpost.submitchanges();
no record gets updated
thanks all. missing primary key on id field in dbml file.
Comments
Post a Comment