So I have a problem with updating values in database using linq.
I mapped my database using linq to sql, and there are two tables which are linked to eachother by one to many relation. So in my code if I want to change the foreign key value in child table and SubmitChanges(), I get the ForeignKeyReferenceAlreadyHasValueException.
I also tried to assign the whole (existing) object of the parent table class to the property created by linq in child table class, but in this case, new rows in parent table are inserted instead of updating the foreign key in child table.
How can I handle this error, can someone help?
Thx!
I mapped my database using linq to sql, and there are two tables which are linked to eachother by one to many relation. So in my code if I want to change the foreign key value in child table and SubmitChanges(), I get the ForeignKeyReferenceAlreadyHasValueException.
I also tried to assign the whole (existing) object of the parent table class to the property created by linq in child table class, but in this case, new rows in parent table are inserted instead of updating the foreign key in child table.
How can I handle this error, can someone help?
Thx!