ADO.NET DataService Exception

Posted by Ravi on Stack Overflow See other posts from Stack Overflow or by Ravi
Published on 2010-05-20T04:28:28Z Indexed on 2010/05/20 4:40 UTC
Read the original article Hit count: 161

Filed under:

Hi,

I am working on C#.Net with ADO.NET Dataservice. I try to update one record to relational tabel, when I reach context.SetLink() I am getting exception("The context is not currently tracking the entity"). I don't know how to solve this problem. My code is specified below.

LogNote dbLogNote =logNote;
LogSubSession dbLogSubSession = (from p in context.LogSubSession
                                 where p.UID == logNote.SubSessionId
                                 select p).First<LogSubSession>()
                                 as LogSubSession;
context.AddToLogNote(dbLogNote);
dbLogNote.LogSubSession = dbLogSubSession;
context.SetLink(dbLogNote, "LogSubSession", dbLogSubSession);
context.SaveChanges();

Here LogSubSession is a primary table and LogNote is a foreign table. I am updating data into foreign table based on primary key table.

Thanks

© Stack Overflow or respective owner

Related posts about ADO.NET