title: Split a DataTable into 2 or more DataTables based on division of Column value
body: <p>The Datatable I'm having</p>
  
  <pre> 
  
    EmpID    |    EmpName   |  Values |   Rowindex
   _______        _______      _______    _______
  
     1             a            10         0
     2             b            10         1
     3             c            10         2
     4             d            10         3
     5             e            10         4
     6             f            10         5
     7             g            10         6
     8             h            10         7
     9             i            10         8
  
  </pre>
  
  <p>The Datatables i need from the above is </p>
  
  <p>Datatable 1 :</p>
  
  <pre> 
    EmpID    |    EmpName   |  Values |   Rowindex
   _______        _______      _______    _______
  
     1             a            10         0
     2             b            10         1
     3             c            10         2
     4             d            10         3
     5             e            10         4
  
  </pre>
  
  <p>Datatable 2</p>
  
  <pre>
  
    EmpID    |    EmpName   |  Values |   Rowindex
   _______        _______      _______    _______
     6             f            10         0
     7             g            10         1
     8             h            10         2
     9             i            10         3
  
  </pre>
  
  <p><strong>Condition to split:</strong></p>
  
  <ul>
  <li>The rowindex should be divided by 5. </li>
  <li>The first datatable should contain the values whose remainder is 0</li>
  <li>and the second should contain values whose remainder is 1 and viceversa. </li>
  <li>The rowindex in the datatables should start from zero.</li>
  </ul>
  
  <p><strong>P.s:</strong> I know to split based on column values. Dont know to split after calculations.</p>
  
  <p><strong>Coding to split based on Columnvalues:</strong>          </p>
  
  <pre><code>RequestDS = MYDataset
  
              Dim dsTablesById As New DataSet()
              For Each row As DataRow In RequestDS.Tables(0).Rows
                  Dim ID As String = row("ID").ToString()
                  If Not dsTablesById.Tables.Contains(ID) Then
                      dsTablesById.Tables.Add(ID)
                      For Each col As DataColumn In RequestDS.Tables(0).Columns
                          dsTablesById.Tables(ID).Columns.Add(col.ColumnName, col.DataType)
                      Next
                  End If
                  dsTablesById.Tables(ID).Rows.Add(row.ItemArray)
                  dsTablesById.Tables(ID).AcceptChanges()
                  ViewState("TableDataset") = dsTablesById
              Next
  </code></pre>