Friday, May 01, 2009

A member defining the identity of the object cannot be changed.

ERROR:

Value of member 'PrimaryKeyColumn' of an object of type 'TableName' changed.

A member defining the identity of the object cannot be changed.

Consider adding a new object with new identity and deleting the existing one instead.



If you get this error, let me make it simple for you.

You have a varchar primary key which is different then your main table's primary key.



LINQ is CASE SENSITIVE so if the two tables with the same primary key do not match you will see this error.



The simple solution that I fould was to run the update statement below



UPDATE TableName

Set PrimaryKeyColumn = UPPER( PrimaryKeyColumn )



This made sure that the table has all uppercase values



Comments:

Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]