hi all
I have 2 tables Customers and Orders it have relationship one-to-many and i set the cascade between tables. i add both tables to one form and i set EndEdit event to the CustomerBindingSource owing to Saves the new record in Customers before save new record to the Orders but i receives error :
A foreign key value cannot be inserted because a corresponding primary key value does not exist.
I find solve but it is complex code must write it in the TableAdapter class
I hope finde easy slove
link: Inserting Master-Detail Data into a SQL-Server Compact Edition Database - Beth Massi - Sharing the goodness - Site Home - MSDN Blogs
Thanks to help
I have 2 tables Customers and Orders it have relationship one-to-many and i set the cascade between tables. i add both tables to one form and i set EndEdit event to the CustomerBindingSource owing to Saves the new record in Customers before save new record to the Orders but i receives error :
A foreign key value cannot be inserted because a corresponding primary key value does not exist.
I find solve but it is complex code must write it in the TableAdapter class
I hope finde easy slove
link: Inserting Master-Detail Data into a SQL-Server Compact Edition Database - Beth Massi - Sharing the goodness - Site Home - MSDN Blogs
Thanks to help