I got error i like this "SYNTAX ERROR IN QUERY EXPRESSION _Name= ' ' " Help me please . what's wrong with my code ?
Try
Connection.Open()
Dim query As String
query = ("SELECT * from RegistrationTable WHERE _Name = '" & ListBox1.Text & "'")
command = New OleDbCommand(query, Connection)
Reader = command.ExecuteScalar
While Reader.Read
txtPID.Text = Reader("PatientID")
txtName.Text = Reader("_Name")
txtAge.Text = Reader("_Age")
cmbGender.Text = Reader("_Gender")
End While
Connection.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
Connection.Dispose()
End Try
That underscore means that you need square brackets:
"SELECT * from RegistrationTable WHERE [_Name] = '" & ListBox1.Text & "'"