Hi, a pleasant day to all.
I just wanna ask if it is possible to search any string or keyword inside my Access Database using the search in my VB.net application? Most of the tutorials only teach on how to search the table using an exact keyword or input.
Example: I want to search the name JOHN SMITH. To be able to search that name, I need to type the whole name because if I only type JOHN there is zero result. If I only type SMITH there is also no result.
What I want is if type any of the two, there is a result. Even if just type "OHN" or "SMI" the name would be still in the result and wont return a no record found.
Is this possible? Thank you in advance.
By the way here is my code:
Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
If txtSearch.Text = "" Then
Call notFound()
Exit Sub
Else
AdminRecordBindingSource.Filter = "(Convert(OfficeOrigin, 'System.String') LIKE '" & txtSearch.Text & "')" &
"OR (OfficeOrigin LIKE '" & txtSearch.Text & "') OR (Particulars LIKE '" & txtSearch.Text & "') OR (ReceivedBy LIKE '" & txtSearch.Text & "')
OR (DateReceived LIKE '" & txtSearch.Text & "') OR (StartTime LIKE '" & txtSearch.Text & "') OR (ActionTaken LIKE '" & txtSearch.Text & "')
OR (FinishTime LIKE '" & txtSearch.Text & "') OR (TotalTime LIKE '" & txtSearch.Text & "') OR (Remarks LIKE '" & txtSearch.Text & "')"
If AdminRecordBindingSource.Count <> 0 Then
With DataGridView1
.DataSource = AdminRecordBindingSource
End With
Else
MsgBox("No record found")
AdminRecordBindingSource.Filter = Nothing
End If
End If
End Sub