hi,
I am using datarelation to join two datatables.
Here is my code,
I would like to display both the tables, dt1 and dt2 in the datagrid, NewDg.
Now it displays only the data of datatable dt1.
I want to display both the tables.I tried to use DataView, but could not get any output.
could someone please guide me. thank you
I am using datarelation to join two datatables.
Here is my code,
Code:
Dim dt1 As New DataTable
dt1.Load(dr1)
Dim dt2 As New DataTable
dt2.Load(dr2)
Dim datarelation As DataRelation
Dim dc1 As DataColumn
Dim dc2 As DataColumn
Dim ds As New DataSet
ds.Tables.Add(dt1)
ds.Tables.Add(dt2)
dc1 = dt1.Columns("CL_R")
dc2 = dt2.Columns("CL_R")
datarelation = New DataRelation("JoinData", dc1, dc2)
ds.Relations.Add(datarelation)
NewDg.DataSource = ds
NewDg.DataBind()
Now it displays only the data of datatable dt1.
I want to display both the tables.I tried to use DataView, but could not get any output.
Code:
Dim dv As New DataView(ds.Tables("dt2"))
NewDg.DataSource = dv