DataGridView - DataRelation + display



Dear Group,
I’m retrieving data from a remote MySQL database server via MySQL .NET
Connector to a set of tables placed in one DataSet object. That works

The display of typical DataTable works perfectly, but problems occur
while I’m trying to create DataRelations in parent table with two
child tables. My parent table looks like the following sample:


My DataRelations are quite simple:
Parent table field named as ChildTable_ID is related with the ID field
from ChildTable. Obviously the parent table field ChildTable2_ID is
related with the ID field from ChildTable2.

My DataRelations are the following (which I've created):
DataRelation^ dr_1 = gcnew DataRelation(“my_relation_id1”, my_dataset-
Tables[“parent_table”]->Column[“ChildTable_ID”], my_dataset->Tables
DataRelation^ dr_2 = gcnew DataRelation(“my_relation_id2”, my_dataset-
Tables[“parent_table”]->Column[“ChildTable2_ID”], my_dataset->Tables

Then I add them to DataSet object and that works fine.
Till now is perfect. I’m displaying DataSet-DataTable “parent_table”
in a DataGridView, with a .. problem. The only way to set a DataMember
in DataGridView is singular DataMember – in fact, even when I select
“my_ralation_id1” as a DataMember, fields from “parent_table” normally
shown, are missing – why?

Is there any simple solution for displaying data in a DataGridView,
populated from dataset table including relations – to be viewed as
additional columns in DGV?

Thank you very much for help.
All the best,
Przemek M. Zawada

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question