This post will explain how to iterate through datatable and how to get value based on index.


//This function is used to iterate through datatable
private void GetAllRows(DataSet ds){
   // iterate through table in the DataSet
get the values of each row.

   foreach(DataTable currTable in ds.Tables){
      // iterate through row
      foreach(DataRow currRow in currTable.Rows){
//iterate through column
         foreach(DataColumn currCol in currTable.Columns){
            Console.WriteLine(currRow[currCol]);
         }
       }
   }
}

//This one line of code is used to access based on row and column index.
currTable.Rows[0][1]      --- represents the value in first row and second