title: I get an invalid ordinal error when reading from a database
body: <pre><code>    Dim sqlCountQuery As String = "SELECT COUNT(*) FROM codes"
      Dim SQLConnection As MySqlConnection = New MySqlConnection
      Dim CountCommand As New MySqlCommand(sqlCountQuery, SQLConnection)
      SQLConnection.ConnectionString = strServerString
      SQLConnection.Open()
      reader = CountCommand.ExecuteReader
      reader.Read()
      CodeCounter = reader.GetInt32(0)
      SQLConnection.Close()
  
  
  
      Dim sqlQuery As String = "SELECT * FROM codes"
      Dim Command As New MySqlCommand(sqlQuery, SQLConnection)
      SQLConnection.Open()
      reader = Command.ExecuteReader()
      reader.Read()
  
      For b = 0 To CodeCounter - 1
          test = reader.GetInt32(b)
      Next
  </code></pre>
  
  <p>The top bit of code retrieves the number of codes currently stored in the database but when I move on to the second part with the for loop, it correctly retrieves the first code from the database, but after that I get an error saying "You have specified an invalid column ordinal.". I have been running it line by line which is how I know it retrieves the first code correctly.</p>