title: how to store values data reader values from database into an array? vb.net
body: <p>Is there a way to store data from a sql data reader values to an array? </p>
  
  <p>this is my code</p>
  
  <pre><code> Dim machines() As Integer
  Sub machine_entire()
      Try
          'getting lines from the database
          If conn.State = ConnectionState.Closed Then conn.Open()
          With cmd
              .Connection = conn
              .CommandText = "select machineID from tbl_prod_machine where lineID = '" &amp; lineID &amp; "' order by machineID asc"
          End With
          dr = cmd.ExecuteReader
          If dr.HasRows Then
              While dr.Read
                  machines = {dr.GetInt32(dr.GetOrdinal("machineID"))}
              End While
              dr.Close()
          End If
          dr.Close()
      Catch ex As DataException
          MessageBox.Show(ex.Message, ex.GetType.ToString)
      Catch ex As SqlException
          MessageBox.Show("Sql Server Error # " &amp; ex.Number &amp; ": " &amp; ex.GetType.ToString)
      End Try
  End Sub
  </code></pre>
  
  <p>thank you! for the help</p>