database - Linq update "An object specified for refresh is not recognized" -
so have simple update method
public sub savereferralformsettings(byval p_clsreferralformsettings referralformsetup) c_dbmlrefernet.refresh(linq.refreshmode.overwritecurrentvalues, p_clsreferralformsettings) c_dbmlrefernet.submitchanges() end sub
i have set primary key on referralformsettings table. can see object populated.
but still error when trying update row in db. why??
i have tried removing table dbml file re-adding suggested here how did wrong datacontext? tried replies in linq sql not update when data has changed in database can not see why getting error or how resolve? appreciated ty.
also tried adding line
c_dbmlrefernet.referralformsetups.attach(p_clsreferralformsettings)
still no joy
ok found solution , doing wrong. checklist others.
- verify primary key set on table , in dbml file
- ensure object populated when beiing passed method update.
- now make sure attach object dbml ie c_dbmlrefernet.referralformsetups.attach(p_clsreferralformsettings)
- ensure refresh "keepcurrentvalues" update db values passed in on object.
hope helps.
Comments
Post a Comment