I’m constructing a Windows Forms application that accesses SQLServer
data via a dataset. The dataset contains 2 tables “tblMaster” and
“tblDetail” which are related in a one-to-many relationship on the field
“MasterID” (the primary key in “tblMaster” and the foreign key in
“tblDetail”). Each table is bound to a datagrid at design time using
the property window. The binding is as follows:
masterDatagrid.datasource = dataset1
masterDatagrid.datamember = “tblMaster”
detailDatagrid.datasource = dataset1
detailDatagrid.datamember = “tblMaster.tblMastertblDetail” where
tblMastertblDetail is the name of the DataRelation object relating the 2
tables in dataset1
When I run the application and select a row in “masterDatagrid” all
related records in the “detailDatagrid” appear as expected. However,
when I add a new record to “detailDatagrid”, click on the row header of
the row containing the new record to “save” the record back to the
dataset (without moving to another record in “detailDatagrid”), select a
different record from the “masterDatagrid”, then reselect the original
record from “masterDatagrid”, I find that the detail record that I
thought I was saving has disappeared.
Is this a bug or am I doing something wrong?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!