Click here to Skip to main content
13,145,608 members (38,857 online)
Rate this:
Please Sign up or sign in to vote.
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!

Posted 13-Nov-12 4:58am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100