Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 13-Nov-12 5:58am

1 solution

Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 450
1 OriginalGriff 230
2 DamithSL 150
3 Dave Kreskowiak 120
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,740
1 DamithSL 5,644
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,011
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2014
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