JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Well,
I'm back, and though I've gotten quite far with the handling of Datasets and the like, the majority of the time I find my self writing my own handlers for such things as opposed to working the way .Net wants me to. *chuckle* yes, i have control issues.
Anyway, so i've got a very basic database, three tables, and a stored proc. The three tables are constrained Table 1 is Primary to Table 2 which is one-to-one rel'd with table 3. Simple.
So on my form i have the standard .Net components (previous I wrote my own handler class that manipulates and controls ALL of this, but frankly I don't want to waste the time for this project, as it isn't that complex to begin with).
DataSet
AdapterManager
3 Adapters
3 Binding Sources
Binding Navigator
The Navigator is Attached to BS1 for Tbl1, which has 3 editable fields in details view on the form. (textboxes to be simple)
Now below the textboxes is a DataGridView attached to BS2 for Tbl2, which is FK dependent on Tbl1.
I click the + on the Binding Navigator to add a new entry into Tbl1 and several things happen. The ID identity field for Tbl1 is set to -1 (the .net way of saying "this is a new record and it's identity won't be set until you commit/update) as well, in the DGV for tbl2 a tentative line is created ready to accept a new entry as well.
I fill out the fields for Tbl1 and move to the DGV for Tbl2 and try to enter data, however, the moment it leaves the "current" row and attempts to go the next row I get a constraint violation error.
I understand that this is due to some background updating of the dataset, basically to some degree the Tbl2 entry is stored in the dataset prior to Tbl1's entry and because of FK relationship rules that's a no-no. I believe this issue is caused by the differences in row addition handling between a Details View and DGV, and was curious how to bypass? handle? whatever this situation.
Desire:
Ideas?
I'm back, and though I've gotten quite far with the handling of Datasets and the like, the majority of the time I find my self writing my own handlers for such things as opposed to working the way .Net wants me to. *chuckle* yes, i have control issues.
Anyway, so i've got a very basic database, three tables, and a stored proc. The three tables are constrained Table 1 is Primary to Table 2 which is one-to-one rel'd with table 3. Simple.
So on my form i have the standard .Net components (previous I wrote my own handler class that manipulates and controls ALL of this, but frankly I don't want to waste the time for this project, as it isn't that complex to begin with).
DataSet
AdapterManager
3 Adapters
3 Binding Sources
Binding Navigator
The Navigator is Attached to BS1 for Tbl1, which has 3 editable fields in details view on the form. (textboxes to be simple)
Now below the textboxes is a DataGridView attached to BS2 for Tbl2, which is FK dependent on Tbl1.
I click the + on the Binding Navigator to add a new entry into Tbl1 and several things happen. The ID identity field for Tbl1 is set to -1 (the .net way of saying "this is a new record and it's identity won't be set until you commit/update) as well, in the DGV for tbl2 a tentative line is created ready to accept a new entry as well.
I fill out the fields for Tbl1 and move to the DGV for Tbl2 and try to enter data, however, the moment it leaves the "current" row and attempts to go the next row I get a constraint violation error.
I understand that this is due to some background updating of the dataset, basically to some degree the Tbl2 entry is stored in the dataset prior to Tbl1's entry and because of FK relationship rules that's a no-no. I believe this issue is caused by the differences in row addition handling between a Details View and DGV, and was curious how to bypass? handle? whatever this situation.
Desire:
- Add item to Tbl1 Details Controls
- Add as many entries to Tbl2 DGV to be attached to Tbl1 Entry
- Add the 3 Details View values to Tbl3 which are 1-to-1 with tbl2 ID.
- Save, and the system/dataset/.net whatever updates them in the order tbl1/2/3 as they should be, while keeping the "fictitious" negative (-1,-2) ID fields in order to obey constraints
Ideas?