Binding a DataGridView to multiple Tables in DataViewManager or DataSet

bindingdatagridviewdatasetdataviewmanager

I have created three data tables by pulling data from an sql database. DT1, DT2, DT3.
I have added these three tables to a data set, myDS.
I have added relations between these three tables.
I then dragged a DataGridView onto my form and I want to bind the three tables to the DataGridview. So I added my dataset DS to a dataview manager, myDVM. I bound myDVM to a bindingsource, bindingSource1, and made it the data source for the DataGridView.
I am not sure how to bind the tables I want from myDVM / bindingSource1, to appear in the DataGridView.
i want to display the child tables related to the parent table using primary key in the same datagridview!!

thanks in advance!!!

help me plz!!!

Best Answer

If by "display the child tables" you mean display related data from child tables, you should SELECT your data into a single table using the appropriate joins. DataGridViews display their data in a single-table format - there is no "multiple table" concept in a DataGridView.

DataSet.Merge() can help you to merge DataRows from separate objects into one.

Related Topic