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
Post a Comment