I am using datarelation to join two datatables.
Here is my code,
Expand|Select|Wrap|Line Numbers
- 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.
Expand|Select|Wrap|Line Numbers
- Dim dv As New DataView(ds.Tables("dt2"))
- NewDg.DataSource = dv