title: vb.net mutiple tables in dataset relations
body: <p>Don't know if this is even possible, but...
  I have 3 tables:
  CustomerTable
  OrderHeaderTable
  OrderDetailTable</p>
  
  <p>The relationships are CustomerTable.CustomerNumber to OrderHeaderTable.CustomerNumber,
  OrderHeaderTable.OrderNumber to OrderDetail.OrderNumber.</p>
  
  <p>I am using DevExpress XtraGrid to display the information, using SQL stored procedure to capture data.</p>
  
  <p><strong>I want/need to be able to form relation between OrderHeader and OrderDetail to display in grid but am unsure of how to make this work within code I have used thus far.</strong></p>
  
  <p>Here is the VB code:</p>
  
  <pre><code>    Dim bsOrders As New BindingSource
      Dim dsDataSetOrders As New DataSet
      Dim daDataAdapter As New SqlDataAdapter
  
      Using cmd As New SqlClient.SqlCommand("spViewOrders", GetOpenConnection) With {.CommandType = CommandType.StoredProcedure}
          With cmd.Parameters
              .Add(New SqlParameter("@Action", SqlDbType.Int)).Value = 44
              .Add(New SqlParameter("@Exists", SqlDbType.Int)).Direction = ParameterDirection.InputOutput
          End With
  
          daDataAdapter.SelectCommand = cmd
          daDataAdapter.Fill(dsDataSetOrders, "Orders")
          dsDataSetOrders.Relations.Add(New DataRelation("OrderHeader", dsDataSetOrders.Tables(0).Columns("Customer #"), _
                                                         dsDataSetOrders.Tables(1).Columns("Customer #")))
  
          bsOrders.DataSource = dsDataSetOrders
          bsOrders.DataMember = "Orders"
      End Using
  
  
      GridControl1.DataSource = bsOrders
      GridView1.BestFitColumns()
  </code></pre>