title: How do I extract data from a DataTable?
body: <p>I have a <code>DataTable</code> that is filled in from an SQL query to a local database, but I don't know how to extract data from it.
  Main method (in test program):</p>
  
  <pre class="lang-cs prettyprint-override"><code>static void Main(string[] args)
  {
      const string connectionString = "server=localhost\\SQLExpress;database=master;integrated Security=SSPI;";
      DataTable table = new DataTable("allPrograms");
  
      using (var conn = new SqlConnection(connectionString))
      {
          Console.WriteLine("connection created successfuly");
  
          string command = "SELECT * FROM Programs";
  
          using (var cmd = new SqlCommand(command, conn))
          {
              Console.WriteLine("command created successfuly");
  
              SqlDataAdapter adapt = new SqlDataAdapter(cmd);
  
              conn.Open(); 
              Console.WriteLine("connection opened successfuly");
              adapt.Fill(table);
              conn.Close();
              Console.WriteLine("connection closed successfuly");
          }
      }
  
      Console.Read();
  }
  </code></pre>
  
  <p>The command I used to create the tables in my database:</p>
  
  <pre class="lang-sql prettyprint-override"><code>create table programs
  (
      progid int primary key identity(1,1),
      name nvarchar(255),
      description nvarchar(500),
      iconFile nvarchar(255),
      installScript nvarchar(255)
  )
  </code></pre>
  
  <p>How can I extract data from the <code>DataTable</code> into a form meaningful to use?</p>