This code is giving me this error:
The object cannot be deleted because it was not found in the ObjectStateManager
using (var context = new MvcApplication4.Entity.test2Entities())
{
var q = (from t in context.tag
where t.tag_id == tag
select new
{
t
}).FirstOrDefault();
if (q != null)
{
context.DeleteObject(q);
context.SaveChanges();
}
}
Am I missing something here?