none
InvalidOperationException RRS feed

  • General discussion

  • I am receiving an InvalidOperationException when I am trying to Update a record in my database.

     It states:

    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.

     

    How do I resolve this issue?

     

    Here is the code....

     

    Certco_Test_Item_State acti = aItemState.Single(p => p.Item_No_ == acode);

    acti.State_Code =

    "WI";

    adcdc.SubmitChanges();

    • Changed type Yichun_Feng Tuesday, August 25, 2009 1:24 AM Don't follow up with some details
    Tuesday, August 18, 2009 6:26 PM

All replies

  • Is StateCode part of the primary key?
    Kristofer - Huagati Systems Co., Ltd. - Cool tools for Linq-to-SQL and Entity Framework: www.huagati.com/dbmltools (VS designer add-in), www.huagati.com/L2SProfiler (query profiler for L2S)
    Wednesday, August 19, 2009 2:02 AM
    Answerer
  • Hi Exoterike,

    We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Best Regards

    Yichun Feng

    Tuesday, August 25, 2009 1:24 AM