所以我有一個在數據庫中的表,只有一個列是一個nvarchar(800)。屬性「文本」是對象的關鍵信息的一部分,不能修改
當我嘗試這樣做:
try
{
UserTable = (from x in entities.userTable where x.uID == uID select x).Single();
UserTable.DateCreated = DateTime.Now;
UserTable.text= newText;
Update(UserTable);
}
我得到捕捉到了異常:"The property 'text' is part of the object's key information and cannot be modified."
當我看着桌子上,我看不出在「關鍵」或「指數」什麼。所以這不是關鍵,我不明白爲什麼C#會給我提供不正確的信息。 SQL Management Studio中沒有任何關於「text」是鍵或索引的內容。我該怎麼辦?
哦,你說的對,uID不是關鍵,我以爲是。現在uID是一個主鍵。但是,它仍然會給出同樣的例外。 – Dexter 2011-01-06 20:43:00