Create a DataRelation Between Two Table Fields...

By Goniey N (Mr. G)

Show How To Create A Relationship Between Two Tables Using Coding...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Here In "Customers" Table "CustomerID" Is Primary Key & It Will Do Relation With "Order" Table's "CustomerID" Field As Foreig Key...
Dim ds As New DataSet()
Dim CustomersOrdersRelation As New DataRelation("CustomersOrders", ds.Customers.Columns("CustomerID"), ds.Orders.Columns("CustomerID"))
'Add New Created Relation...
ds.
Relations.Add(customersOrdersRelation)
End Sub

Create a DataRelation Between Two Table Fields...  (706 Views)