Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The property 'text' is part of the object's key information and cannot be modified

So I have a table in the database, with a column that is simply an nvarchar(800).

When I try to do:

try
{
    UserTable = (from x in entities.userTable where x.uID == uID select x).Single();
    UserTable.DateCreated = DateTime.Now;
    UserTable.text= newText;
    Update(UserTable);
}

I get the exception in catch: "The property 'text' is part of the object's key information and cannot be modified."

When I look into the table, I don't see anything under "key" or "index". So it's not a key, I don't understand why C# is giving me incorrect information. Nothing in SQL Management Studio says anything about "text" being a key or index. What do I do?

like image 716
Dexter Avatar asked Jan 06 '11 20:01

Dexter


1 Answers

Is there a PK on the table at all? If not, EF uses all of the fields/columns as part of the "key information."

like image 150
lukiffer Avatar answered Sep 23 '22 00:09

lukiffer