How can we add relation’s between table in a DataSet

Q

How can we add relation’s between table in a DataSet ?

✍: Guest

A
Dim objRelation As DataRelation
objRelation=New
DataRelation("CustomerAddresses",objDataSet.Tables("Customer").Columns("Custid")
,objDataSet.Tables("Addresses").Columns("Custid_fk"))
objDataSet.Relations.Add(objRelation)

Relations can be added between “DataTable” objects using the “DataRelation” object. Above sample code is trying to build a relationship between “Customer” and “Addresses” “Datatable” using “CustomerAddresses” “DataRelation” object.

2007-10-24, 4482👍, 0💬