title: Getting error for Data Reader in vb.net
body: <p>Im facing the error when execute the data reader command in vb.net. it throw handling. This field like when you enter employee id in textbox then it will capture in database for other field name,department.</p>
  
  <p>here is my code</p>
  
  <pre><code>Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
  
  Dim conn As New MySql.Data.MySqlClient.MySqlConnection
  
  Dim strConnectionString As String =ConfigurationManager.ConnectionStrings("testConnectionString").ConnectionString
  
  Dim sqlQuery As String = "SELECT * hr_record WHERE Emplid='" &amp; txt1.Text &amp; "'"
  
  Using sqlConn As New MySqlConnection(strConnectionString)
  
        Using sqlComm As New MySqlCommand()
  
        With sqlComm
  
          .CommandText = sqlQuery
  
            End With
  
                Try
                    sqlConn.Open()
  
                      Dim sqlReader As MySqlDataReader = sqlComm.ExecuteReader()
  
                      While sqlReader.Read()
  
                          txt1.Text = sqlReader("Emplid").ToString()
  
                          TextBox1.Text = sqlReader("Nama").ToString()
  
                          TextBox2.Text = sqlReader("DeptDesc").ToString()
  
                      End While
  
                  Catch ex As MySqlException
  
                      MessageBox.Show(ex.Message)
                  End Try
  
              End Using
  
          End Using
  
      End Sub
  </code></pre>