I have an insert statement before these updates: On db.sumbitchanges the error is shown.
Topic top = (from t in db.Topics
where t.id == id
select t).SingleOrDefault();
top.lastpost = username + maxdate;
Category ca = (from c in db.Categories
where c.categoryid == cat
select c).SingleOrDefault();
ca.totaltopics = ca.totaltopics + 1;
ca.posts = ca.posts + 1;
ca.lastpost = username + maxdate;
db.SubmitChanges();