M
Magnus
I'm testing walkthrough saving data to a Database (Multiple Tables).
http://msdn2.microsoft.com/en-us/library/4esb49b4(VS.80).aspx
In the famous Customer/Order example, I'm getting referential integrity
problems "The INSERT statement conflicted with the FOREIGN KEY
constraint..." if the identity/primary key column is "out of sync" with the
identity value in the database. I can easily acheive this f.ex. by pressing
add new record, cancel then add again and filling out customer and order
details. Obviously the customerId column in the order table has the wrong
values after the customer table has been inserted, as the customerid in the
customer table is updated to whatever number the database has given to the
record. Should I now update the columns referencing the customerID field
manually by code? Or how is a good way to do this?
I can't find any articles on how this can be effectively handled, can anyone
give me some pointers or give an example on how this should/could be
handled?
- Magnus
http://msdn2.microsoft.com/en-us/library/4esb49b4(VS.80).aspx
In the famous Customer/Order example, I'm getting referential integrity
problems "The INSERT statement conflicted with the FOREIGN KEY
constraint..." if the identity/primary key column is "out of sync" with the
identity value in the database. I can easily acheive this f.ex. by pressing
add new record, cancel then add again and filling out customer and order
details. Obviously the customerId column in the order table has the wrong
values after the customer table has been inserted, as the customerid in the
customer table is updated to whatever number the database has given to the
record. Should I now update the columns referencing the customerID field
manually by code? Or how is a good way to do this?
I can't find any articles on how this can be effectively handled, can anyone
give me some pointers or give an example on how this should/could be
handled?
- Magnus