title: looping through data table to get two specifics values from each row
body: <p>I 'm trying to loop through a <code>datatable</code> and print out the values of the</p>
  <ul>
  <li>0,</li>
  <li>1 and</li>
  <li>4th cell of each row,</li>
  </ul>
  <p>And it feels like this should be working but I'm probably messing up the loop somehow.</p>
  <pre><code> foreach (DataRow dr in dt.Rows)
   {
        for (int x = 0; x &lt; dt.Rows.Count; x++)
        {
            Console.WriteLine(dt.Columns[0].ColumnName + &quot; &quot;);
            Console.WriteLine(dt.Rows[x].ItemArray[0].ToString() + &quot; &quot;);
            Console.WriteLine(dt.Columns[1].ColumnName + &quot; &quot;);
            Console.WriteLine(dt.Rows[x].ItemArray[1].ToString() + &quot; &quot;);
            Console.WriteLine(dt.Columns[4].ColumnName + &quot; &quot;);
            Console.WriteLine(dt.Rows[x].ItemArray[4].ToString() + &quot; &quot;);
         }
   }
  </code></pre>
  <p>The above code gives me this error:</p>
  <blockquote>
  <p>The system cannot execute the specified program.</p>
  </blockquote>