I have a dataset with two tables..."DEPT", "EMP"
They have column "DEPTNO" in common...
I have made a relation and tied the dataset to a datagrid "dgDEPT" and the relationship works.
What I want to do is have a grid as the DEPT table and when I select on a record...I want a separate grid to show the child records...any idea?
At present dgDEPT shows the DEPT records and has "+" so I can look at the child records
=====================================================
Dim strEMP, strDEPT As String
strEMP = "Select * from EMP"
strDEPT = "Select * from DEPT"
Dim dsEMP = New DataSet
Dim daEMP = New OleDb.OleDbDataAdapter(strEMP, conn)
Dim daDEPT = New OleDb.OleDbDataAdapter(strDEPT, conn)
daEMP.Fill(dsEMP, "EMP")
daDEPT.Fill(dsEMP, "DEPT")
conn.Close()
'EXAMPLE OF MANUAL BINDING
dsEMP.Relations.Add("MINE", dsEMP.Tables("DEPT").Columns("DEPTNO"), dsEMP.Tables("EMP").Columns("DEPTNO"))
dgDEPT.SetDataBinding(dsEMP, "DEPT")
==============================================
thanks
They have column "DEPTNO" in common...
I have made a relation and tied the dataset to a datagrid "dgDEPT" and the relationship works.
What I want to do is have a grid as the DEPT table and when I select on a record...I want a separate grid to show the child records...any idea?
At present dgDEPT shows the DEPT records and has "+" so I can look at the child records
=====================================================
Dim strEMP, strDEPT As String
strEMP = "Select * from EMP"
strDEPT = "Select * from DEPT"
Dim dsEMP = New DataSet
Dim daEMP = New OleDb.OleDbDataAdapter(strEMP, conn)
Dim daDEPT = New OleDb.OleDbDataAdapter(strDEPT, conn)
daEMP.Fill(dsEMP, "EMP")
daDEPT.Fill(dsEMP, "DEPT")
conn.Close()
'EXAMPLE OF MANUAL BINDING
dsEMP.Relations.Add("MINE", dsEMP.Tables("DEPT").Columns("DEPTNO"), dsEMP.Tables("EMP").Columns("DEPTNO"))
dgDEPT.SetDataBinding(dsEMP, "DEPT")
==============================================
thanks