BindingSource master detail problems

  • Thread starter Thread starter sirtrolle
  • Start date Start date
S

sirtrolle

Hi, I'm having some problems when working with BindingSources.

I have a form which contains some master detail data.

The setup:
A DataSet with two tables, a master table, a details table, and a
datarelation.
A BindingSource which is databound to the master table.
A BindingSource which is databound to the master BindingSource, and
having the datarelation as the datamember.
A BindingNavigator which is bound to the master BindingSource.
And some controls bound to the BindingSources.

The reason for this setup, is to have more child table relations in the
future.

The problem is as follows:
When a new record is added to the master BindingSource (using the
BindingNavigator), I manually add a new record in the details
BindingSource using the AddNew() method.
This is all fine, and both the BindingSources Current properties each
contains a detached datarow, or actually a DataRowView.
But when a save is requested, EndEdit is called and udates are posted
to the database, on the master BindingSource first, and then on the
details BindingSource.
But when the master BindingSource calls EndEdit, the detached row in
the details BindingSource dissappears, and is just null.

What am I doing wrong here?
Viewing and navigating data works perfect.

- KTW -
 
Back
Top