可以用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);
 }int rowCtr;
// Declare an array of datarows to hold the child records.
DataRow[] drarray;
// GetChildRows gets related rows. It is a method on the datatable, and
// takes either DataRelation object name as a string.
rowCtr = 0;
drarray = dsCustomersOrders1.Customers[rowCtr].GetChildRows("CustomersOrders");

解决方案 »

  1.   

    后面这段不是看得很清楚.
    int rowCtr;
    // Declare an array of datarows to hold the child records.
    DataRow[] drarray;
    // GetChildRows gets related rows. It is a method on the datatable, and
    // takes either DataRelation object name as a string.
    rowCtr = 0;
    drarray = dsCustomersOrders1.Customers[rowCtr].GetChildRows("CustomersOrders");
      

  2.   

    通过刚才建立的DataRelation得到一个DataRow相关的所有子DataRow,返回的是数组。
      

  3.   

    可以绑定到datagrid上面的看的更清楚地。