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.

  1. verify primary key set on table , in dbml file
  2. ensure object populated when beiing passed method update.
  3. now make sure attach object dbml ie c_dbmlrefernet.referralformsetups.attach(p_clsreferralformsettings)
  4. ensure refresh "keepcurrentvalues" update db values passed in on object.

hope helps.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -