.net - Multiple instances of IEntityChangeTracker error get when try to insert data into database in c# -


multiple instances of ientitychangetracker error when

try insert data database in c#.

i try search solution debuge code can't anythink it.now me resolve this.

    public void insertdatarootmasterdetails(tblrootmasterdetail objstud1)     {          dblaxmitatkalentities2 objentity1 = new dblaxmitatkalentities2();                   objentity1.tblrootmasterdetails.addobject(objstud1);          objentity1.savechanges();     } 

you can use addobject function adding newly created items. seems objstud1 selected ef context. in case should use attach function instead.

objentity1.tblrootmasterdetails.attach(objstud1); objentity1.entry(objstud1).state = system.data.entity.entitystate.modified; objentity1.savechanges(); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -