建立表的关系使用DataRelation类:
private void CreateRelation() {
    // Get the DataColumn objects from two DataTable objects in a DataSet.
    DataColumn parentCol;
    DataColumn childCol;
    // Code to get the DataSet not shown here.
    parentCol = DataSet1.Tables["Customers"].Columns["CustID"];
    childCol = DataSet1.Tables["Orders"].Columns["CustID"];
    // Create DataRelation.
    DataRelation relCustOrder;
    relCustOrder = new DataRelation("CustomersOrders", parentCol, childCol);
    // Add the relation to the DataSet.
    DataSet1.Relations.Add(relCustOrder);更多的参考帮助:
.net框架/参考/类库/System.Data/DataRelation类