Cannot attach an entity that already exists.
Posted
by coure06
on Stack Overflow
See other posts from Stack Overflow
or by coure06
Published on 2010-04-09T07:09:22Z
Indexed on
2010/04/09
7:13 UTC
Read the original article
Hit count: 621
linq-to-sql
|c#
i am trying to update code via Linq, but getting this error
Cannot attach an entity that already exists.
C# code is here
var con = (from c in cmsContentTable where c.ContentName == contentId
select c).FirstOrDefault();
cmsContentTable.Attach(con);
con.ContentData = "New Value";
cmsContentTable.Context.SubmitChanges();
© Stack Overflow or respective owner