Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Windows form with three datagridviews showing data from three separate tables of a SQL Express Server database. The datagridviews all have their own dataadapter, databinding and command builder, and there are two relations relating the tables. I have event handlers for the row added event and the row leave for all three datagridviews. My question is when I add a row to the master table rows get added to the other two. Should I wait until all data is entered to insert the records to the database or insert to master then child1 then child2? Master and child1 are related on a primary/foreign key field. Child1 and child2 are related the same way. I have gotten this far by reading this blog and what others are doing but I don't want to mess this action up. Thanks for any advice you can provide!

Everett
Posted

1 solution

You should not enter data until you have it. If you have the parent data, but not the child, then you have nothing to enter on the child level, unless it's required that each parent has one child ( which is odd ). If having all three tables in a 1 to 1 relationship is important for your code to work, then you need to insert all three at once.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900