This is the entire code that am using in vb 2012 ultimate for the search button
Call FrancisDB()
If txtsearch.Text = "" Then
MsgBox("PLEASE INSERT EMPLOYEE ID", vbCritical + vbOKOnly, "ST PETER'S ANGLICAN PARISH")
Else
Dim SearchNumber As Integer = Me.txtsearch.Text
rs.Open("Select * From [employees] Where Employee ID=" & SearchNumber & "'", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockPessimistic, -1)
If rs.RecordCount = 0 Then
MsgBox("RECORD DOES NOT EXIT", vbCritical + vbOKOnly, "ST PETER'S ANGLICAN PARISH")
rs.Close()
Else
txtAddress.Text = rs("Address").Value
txtContactno.Text = rs("Contact No").Value
txtDcontract.Text = rs("Duration of Contract").Value
txtEid.Text = rs("Employee ID").Value
txtDepartment.Text = rs("Department").Value
txtFname.Text = rs("Full Name").Value
txtnrc.Text = rs("NRC").Value
txtNumChildren.Text = rs("Number of Children").Value
txtPosition.Text = rs("Position").Value
cmbgender.Text = rs("Gender").Value
cmbmstatus.Text = rs("Marital Status").Value
cmbtcontract.Text = rs("Type of Contract").Value
dtpDbirth.Text = rs("Date of Birth").Value
dtpDemployment.Text = rs("Date of Employment").Value
dtpEcontract.Text = rs("End of Contract").Value
MsgBox("RECORD FOUND", vbInformation + vbOKOnly, "ST PETER'S ANGLICAN PARISH")
rs.Close()
End If
End If
con.Close()