Displaying data from 2 tables in one datagridview

  • Thread starter Thread starter Lars E.
  • Start date Start date
L

Lars E.

Hi all.

i am trying to display contents from 2 tables in one datagridview.

It is not possible for me to do a join, so i have to combine 2 datatables to be able to show data from both tables.

My tables are: "Customer" and "Customer Contact".

The relation is: Customer.c-Customerno = CustomerContract.cc-Customerno (the primary key names are not the same)

I want to display customers with the customers contact information.

Do i have to create a new datatable and populate this from det different tables in my dataset.
(ds.tables[0] and ds.tables[1]).

How can i do this. Please help.
 
Thanks, but that link was to VB-Help.

Perhaps i made a request in the wrong newsgroup.

I am trying to do this in C#.
Should i use another newsgroup?

Lars E.
 
So much difference is there not between VBNet and C#

To take the main solution in the sample

\\\
ds.Relations.Add("MyRelation", dt1.Columns["TheRelation"],
dt2.Columns["TheRelation"]);
dt2.Columns.Add("State", Type.GetType("System.String"), "Parent.State");
DataGridView1.DataSource = dt2;
///
Roughly done,

Cor
 
Back
Top