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