dualshock03
Well-known member
- Joined
- Jan 28, 2007
- Messages
- 105
- Programming Experience
- 1-3
Hi people can anyone fix this code?
My concept here is that when i type a userID in the textbox, the second textbox will generate its corresponding fullname of the certain employee matching to the userID.
Im recieving an error that says: " #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='20070001'' at line 1"
The error points to this code:
reader=empnum.ExecuteReader() <-------- is highlighted in yellow
Thanks in advance
My concept here is that when i type a userID in the textbox, the second textbox will generate its corresponding fullname of the certain employee matching to the userID.
VB.NET:
Private Sub btncalreg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalreg.Click
Dim empIDcon As New MySqlConnection("server =localhost; user id=root; password=pat; database=lnupayroll2007")
Dim empnum As New MySqlCommand("SELECT * FROM regularpayroll2007 WHERE Emp_No. ='" & tremp.Text & "'", empIDcon)
Dim reader As MySqlDataReader
empnum.Connection = empIDcon
empIDcon.Open()
reader = empnum.ExecuteReader()
If (reader.Read()) Then
Dim strempName As String
strempName = reader("Fullname").ToString()
trname.Text = strempName
empIDcon.Close()
End If
Im recieving an error that says: " #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='20070001'' at line 1"
The error points to this code:
reader=empnum.ExecuteReader() <-------- is highlighted in yellow
Thanks in advance