title: Looping through a specific column from a datatable
body: <p>I have the following code:</p>
  
  <pre><code>using (connection = new SqlConnection("sql connection goes here"))
  {
      using(command = new SqlCommand(@"SELECT col1, col2, col3 FROM table1 WHERE col1 = @col1 AND col2 = @col2", connection))
      {
          command.Parameters.Add("@col1", SqlDbType.VarChar, 255).Value = TextBox1.Text;
          command.Parameters.Add("@col2", SqlDbType.VarChar, 255).Value = TextBox2.Text;
  
          using (dataadapter = new SqlDataAdapter(command))
          {
              using (datatable = new DataTable())
              {
                  dataadapter.Fill(datatable);
  
                  int intTest = 0;
  
                  foreach (DataRow row in datatable.Rows)
                  {
                      Console.Write(intTest);
                      Console.Write(Environment.NewLine);
                      intTest += 1;
  
                      // replace this with another database query which uses data from above to loop through further sql queries
  
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Works fine.  However, I don't understand how to replace that comment section.  I basically want to read in rows from a specific column in the foreach loop.  How do I enter the values of a specific column into console.write?</p>