title: Invalid attempt to access a field before calling Read() with MySql
body: <p>I am trying to run this code, but this error always pops up when I click on data grid view.</p>
  
  <p>What do you think is the error here? </p>
  
  <pre><code>Private Sub dgvRecords_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvRecords.CellClick
      Dim intID As Integer
      Try
          Integer.TryParse(dgvRecords.Item(0, dgvRecords.CurrentRow.Index).Value, intID)
          Dim dbQuery As String = "Select * from tblstudents where id = " &amp; intID
          Dim dbConnection As New MySqlConnection(dbConString)
          Dim dbCmd As New MySqlCommand(dbQuery, dbConnection)
          Dim dbReader As MySqlDataReader
          dbConnection.Open()
          dbReader = dbCmd.ExecuteReader()
  
          txtStudID.Text = dbReader("id")
          txtLastname.Text = dbReader("lastname")
          txtFirstname.Text = dbReader("firstname")
          txtMiddlename.Text = dbReader("middlename")
          txtAddress.Text = dbReader("address")
          cmbGender.Text = dbReader("gender")
          txtContact.Text = dbReader("contact")
          cmbCivilStatus.Text = dbReader("civil_status")
  
          dbReader.Close()
          dbConnection.Close()
      Catch ex As Exception
          MsgBox("ERROR: " &amp; ErrorToString(), MsgBoxStyle.Critical)
      End Try
  End Sub
  </code></pre>