I have datatable tblEmployeeInfo
and column EmployeeName
with contains data.
EmployeeName Mike Jay Paul
Also I have Textbox1
to type a name and button to "Verify".
How do I check if the Employee Name exists in the column EmployeeName
?
For example, "Jay".
So far this is my code on button "Verify":
conn.Open()
cmd.Connection = conn
cmd.CommandText = "SELECT [Employee Name] FROM tblHolidayOvertimeEntry WHERE [Employee Name] = '" & tbEmployeeName.Text & "' "
Dim result1 as String = cmd.ExecuteNonQuery
conn.Close()
If result1 <> tbEmployeeName.Text Then
MsgBox("No Employee Name found")
Else
MsgBox("Employee name still exist")
End If