c# - Updating a record using Linq-to-SQL -
i've done many times , has worked.
every example i've found have..
i query...
var result = u in tdc.tblusers u.userid == userid select u; and change values want to:
foreach (tblusers u in result) { //change values (and no im not changing primary key or foreign keys) } then submit changes
tdc.submitchanges(); i have tried way before , got same error
tblusers result = (from u in tdc.tblusers u.userid == userid select u).single(); result.address = address; result.phone = phone; tdc.submitchanges(); it ever retrieve 1 record query since userid primary key.
when hits submit changes, throws exception row wasn't found or changed. person using there's no other conflicts accessing db or locking. why throw changeconflictexception? have stepped through debugger , data persists way through process, including changes i'm trying make.
you getting error possibly because 1 of fields has different in linq sql designer , in actual database.
or can take on article
good luck!
Comments
Post a Comment