What wrong with my code ? here's 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")
txtPhone.Text = Reader("_Phone")
txtAddress.Text = Reader("_Address")
txtDisease.Text = Reader("_Disease")
ComboBox1.Text = Reader("_Building")
ComboBox2.Text = Reader("_RoomNo")
txtRT.Text = Reader("_Roomtype")
End While
Connection.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
Connection.Dispose()
End Try
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")
txtPhone.Text = Reader("_Phone")
txtAddress.Text = Reader("_Address")
txtDisease.Text = Reader("_Disease")
ComboBox1.Text = Reader("_Building")
ComboBox2.Text = Reader("_RoomNo")
txtRT.Text = Reader("_Roomtype")
End While
Connection.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
Connection.Dispose()
End Try