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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -