Master/Detail question

  • Thread starter Thread starter Michael Rodriguez
  • Start date Start date
M

Michael Rodriguez

Suppose I have a data entry screen with two strongly-typed datasets,
dsCustomers and dsOrders, as the master and child, respectively.

Because the two tables in the relationship are in two different datasets, I
don't think I can use the DataRelation object to link them. If not, what is
the best way to set up the master/detail relationship for the Windows form
for these two tables? Should I just use a filter on the child table and
manually update it everytime the parent row changes? What approach would be
the fastest?

TIA,

Mike Rodriguez
 
Mike,

I would create a new typed dataset which has the parent and child table
in the same dataset with the DataRelation defined. Then, you can just bind
the child grid to the relation, and it will show the appropriate child
records automatically.

Hope this helps.
 
Nicholas Paldino said:
Mike,

I would create a new typed dataset which has the parent and child table
in the same dataset with the DataRelation defined. Then, you can just
bind the child grid to the relation, and it will show the appropriate
child records automatically.

Hi Nicholas,

While that would certainly work, there are reasons why I want to keep the
two distinct typed datasets. Is there any way to define a relationship in
that scenario, or is my only option a row filter?

Thanks,

Mike
 
Michael,

In that case, no, there isn't. You would have to filter it yourself.

You might want to consider using the unified data set. You can always
copy the data from the two data sets into this data set. It seems like a
lot of extra code and work to replicate behavior that is already in the
framework.
 
Hi Nicholas,

After databinding the dataRelation to the childGrid, I would like to set the
allowNew = false so user can't add the row at the buttom of the childGrid.

However, there is no way to create a dataview for the dataRelation. In other
way, if I create a dataview with allowNew = false, then set the dataview to
be the childGrid datasource, the childGrid just can't change its row when
the currencymanager of the MasterGrid changes.

Is there any method to disallow the childGird add new rows?

Thank you.

Timothy
 
Back
Top