G
Guest
Dear all,
I have a dataset which contains 2 DataTable
The idea is to bind a text box control with one table field and then
diaplaye the associated content of the second table based on the first table
entry.
For that I have been guide to use data relation bettween those two table.
The following code illustrate what I have done :
----->
ds.Tables.AddRange(New DataTable() {tblCustomer, tblApplication})
' Create a DataRelation, and add it to the DataSet.
Dim dr As DataRelation
dr = New DataRelation("custToApp",
tblCustomer.Columns.Item("ORDER"), tblApplication.Columns.Item("ORDER_ID"))
ds.Relations.Add(dr)
Me.ListBox1.DataSource = ds.Tables("CUSTOMER")
Me.TextBox1.DataBindings.Add(New Binding("Text", tblCustomer, "NAME"))
DataGrid1.Visible = True
DataGrid1.DataSource = ds.Tables(1)
---->
As a result I was expected that for the first entry of customer table, the
correponding appication records for that customer gets displayed in the
datagrid, becasue of this relation ojbect.
But insatead in the datagrid I get all records of my application table and
not only the one from one customer name.
What I am doing wrong or did not understand complety. As far as I understand
realtion between 2 coluumns from 2 different table should displayed only
related information..
Thnaks fro your help
serge
I have a dataset which contains 2 DataTable
The idea is to bind a text box control with one table field and then
diaplaye the associated content of the second table based on the first table
entry.
For that I have been guide to use data relation bettween those two table.
The following code illustrate what I have done :
----->
ds.Tables.AddRange(New DataTable() {tblCustomer, tblApplication})
' Create a DataRelation, and add it to the DataSet.
Dim dr As DataRelation
dr = New DataRelation("custToApp",
tblCustomer.Columns.Item("ORDER"), tblApplication.Columns.Item("ORDER_ID"))
ds.Relations.Add(dr)
Me.ListBox1.DataSource = ds.Tables("CUSTOMER")
Me.TextBox1.DataBindings.Add(New Binding("Text", tblCustomer, "NAME"))
DataGrid1.Visible = True
DataGrid1.DataSource = ds.Tables(1)
---->
As a result I was expected that for the first entry of customer table, the
correponding appication records for that customer gets displayed in the
datagrid, becasue of this relation ojbect.
But insatead in the datagrid I get all records of my application table and
not only the one from one customer name.
What I am doing wrong or did not understand complety. As far as I understand
realtion between 2 coluumns from 2 different table should displayed only
related information..
Thnaks fro your help
serge