title: Splitting a DataTable into 2 using a column index
body: <p>I have a stored procedure which selects the differences between rows in a table and returns a <code>DataTable</code> in the following format:</p>
  
  <pre><code>col1_A, col2_A, col3_A, col1_B, col2_B, col3B
  </code></pre>
  
  <p>I would like to split the <code>DataTable</code> into 2 separate <code>DataTable</code>s so it looks like</p>
  
  <p><strong>TableA</strong></p>
  
  <pre><code>col1
  col2
  col3
  </code></pre>
  
  <p><strong>TableB</strong></p>
  
  <pre><code>col1
  col2
  col3
  </code></pre>
  
  <p>This code gets me the column index.</p>
  
  <pre><code>        foreach (DataColumn col in DT.Columns)
          {
              if (!col.ColumnName.EndsWith("B"))
                  tableBIndex += 1;
              else
                  break;
          }
  </code></pre>
  
  <p>but from here I'm not sure how to separate the rows into 2 DataTables. Any ideas on the best way to accomplish this?</p>