asp.net mvc - Why am I getting a "Unable to update the EntitySet because it has a DefiningQuery..." exception when trying to update a model in Entity Framework? -


while updating of linq sql using entity framework, exception thrown.

system.data.updateexception: unable update entityset 't_emp' because has  definingquery , no <updatefunction> element exists in    <modificationfunctionmapping> 

the code update :

public void updateall()     {         try         {               var tb = (from p in _te.t_emp                       p.id == "1"                       select p).firstordefault();             tb.ename = "jack";              _te.applypropertychanges(tb.entitykey.entitysetname, tb);             _te.savechanges(true);         }         catch(exception e)         {          }     } 

why getting error?

the problem in table structure. to avoid error have make 1 primary key in table. after that, update edmx. problem fixed


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -