G
Guest
Background:
I have a data entry form that is bound to a DataSet. This DataSet contains
9 tables and the form displays data from each table in textboxes, not a
DataGrid. One of the tables in the ParentTable and the rest are children.
For Example:
The form shows the Customer and their most recently added Contact (in
textboxes, not in a DataGrid). When I click the Add button on the form, I
enumerate through all of the DataTables in the DataSet and call
BindingContext(DataTable).AddNew(). (Now, make note that the end user may
not always decide to enter a contact's information.) (For this example,
assume that the user did not enter a contact.) When the user clicks on Save,
I again enumerate through all of the DataTables in the DataSet and call
BindingContext(DataTable).EndCurrentEdit(). At this point every table in the
DataSet shows as having 1 row. When really the row for the Contacts table is
blank. This creates problems when trying to insert the data into the
database.
Is there a better way of doing this? I know that I could watch for entry
into any of the fields for the Contacts table and then call AddNew, but that
would be cumbersome to code.
PS - I know that the best way to do this would be to have a button that the
user clicks on to "Add New Contact" and then display a dialog form that would
allow the end user to enter the nessary information, or even just enable the
controls on the main form. That is the best and easiest way to accomplish
what I need to accomplish, however, my client wants it done the way described
above. They are moving from a DOS-based DBase application and want this to
act as much like the old app as possible.
Thanks in advance!!
I have a data entry form that is bound to a DataSet. This DataSet contains
9 tables and the form displays data from each table in textboxes, not a
DataGrid. One of the tables in the ParentTable and the rest are children.
For Example:
The form shows the Customer and their most recently added Contact (in
textboxes, not in a DataGrid). When I click the Add button on the form, I
enumerate through all of the DataTables in the DataSet and call
BindingContext(DataTable).AddNew(). (Now, make note that the end user may
not always decide to enter a contact's information.) (For this example,
assume that the user did not enter a contact.) When the user clicks on Save,
I again enumerate through all of the DataTables in the DataSet and call
BindingContext(DataTable).EndCurrentEdit(). At this point every table in the
DataSet shows as having 1 row. When really the row for the Contacts table is
blank. This creates problems when trying to insert the data into the
database.
Is there a better way of doing this? I know that I could watch for entry
into any of the fields for the Contacts table and then call AddNew, but that
would be cumbersome to code.
PS - I know that the best way to do this would be to have a button that the
user clicks on to "Add New Contact" and then display a dialog form that would
allow the end user to enter the nessary information, or even just enable the
controls on the main form. That is the best and easiest way to accomplish
what I need to accomplish, however, my client wants it done the way described
above. They are moving from a DOS-based DBase application and want this to
act as much like the old app as possible.
Thanks in advance!!