Update Id Primary Key field with C#
Hai, like the title.. I just wanna make sure how if I want to update primary key in 开发者_运维百科LINQ? I did google and found that it`s impossible to update Id in Linq. the other way is I delete the old record and insert new but the problem is it will be not effective if the table has a relationship with other table..maybe someone give me a better way to solve it.
Thanks in advance
If there are dependent rows in another table then you either need to enable the ON UPDATE CASCADE option on the foreign key constraint(s) OR you need to update TWO rows simultaneously. Otherwise you will get a constraint violation error.
精彩评论