title: How to save SELECT sql query results in an array in C# Asp.net
body: <p>How can I save the results of an SQL query into an array?</p>
  <p>I want to use the values (located in col1 and col2) in an IF statement, leading to my thinking of saving them in an array.</p>
  <pre><code>var con = new SqlConnection(&quot;Data Source=local;Initial Catalog=Test;Integrated Security=True&quot;);
          
  using (con)
  using (var command = new SqlCommand(&quot;SELECT col1,col2 FROM  some table&quot;, con))
  {
     con.Open();
     command.ExecuteNonQuery();
  }
  </code></pre>