none
update pk field in linq RRS feed

  • Question

  • Hi friends

    I have problem in update pk field of my table.this field isnt a auto number or identity field and is nchar(21) and my error is :

    Value of member 'code' of an object of type 'Bime' 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. 
    

    this error received just when i want update pk field and my update code have not problem.

    hellllllllllllllllllllllllllllllllllllllllllllllllllllllllp meeeeeeee plz :(

    Thursday, September 9, 2010 10:20 AM

Answers

  • L2S doesn't allow PK column updates. If you need to change the PK for a record, consider using the datacontext's .ExecuteCommand method...


     
       Cool tools for Linq-to-SQL and Entity Framework 4:
     huagati.com/dbmltools - Rule based class and property naming, Compare and Sync model <=> DB, Sync SSDL <=> CSDL (EF4)
     huagati.com/L2SProfiler - Query profiler for Linq-to-SQL and Entity Framework v4
    Thursday, September 9, 2010 10:37 AM
    Answerer

All replies

  • L2S doesn't allow PK column updates. If you need to change the PK for a record, consider using the datacontext's .ExecuteCommand method...


     
       Cool tools for Linq-to-SQL and Entity Framework 4:
     huagati.com/dbmltools - Rule based class and property naming, Compare and Sync model <=> DB, Sync SSDL <=> CSDL (EF4)
     huagati.com/L2SProfiler - Query profiler for Linq-to-SQL and Entity Framework v4
    Thursday, September 9, 2010 10:37 AM
    Answerer
  • there isn't other way?   :(
    Thursday, September 9, 2010 4:45 PM