title: How to add database query results to an array
body: <p>I am trying to select string values from an Access database and then place them into an array of strings so that I can perform a loop statement on the array.</p>
  
  <p>However I don't know how to place the result of the query into an array. I know how to query the database but all I need is how to put the result in an array.</p>
  
  <p>My select statement is <code>Select motonum from moto</code>. I want to put <code>motonum</code> in an array. </p>
  
  <p>The whole code to read the data is:</p>
  
  <pre><code>connect2()
  If Not cnn2.State = ConnectionState.Open Then
      'open connection
      cnn2.Open()
      'MessageBox.Show("chk2")
  End If
  cmd5.Connection = cnn2
  cmd5.CommandText = "Select motonum from moto"
  myData5 = cmd5.ExecuteReader
  While myData5.Read
      'code to return results here
  End While`
  </code></pre>