Help regarding Search with Access DB

kr80

Member
Joined
May 31, 2005
Messages
9
Programming Experience
1-3
Hi,
I am currently using the following code to do a search from Two text Boxes and display them on a datagrid. How do i implement a Pattern match with the text i enter. Something like a LIKE option in SQL.

'OleDbDataAdapter1.Fill(objds1)
'Dim dv As DataView = New DataView(objds1.Software)
'With dv
' .AllowDelete = False
' .AllowEdit = False
' .AllowNew = False
' .RowFilter = "Manufacturer='" + Trim(SearchManu.Text) + "'"
' .RowFilter = "SoftwareName='" + Trim(SearchSoft.Text) + "'"
' .Sort = "SoftwareName DESC"
'End With
'DataGrid1.DataSource = dv

Thanks,
Karl
 
You've got the correct idea, you just need to combine the two criteria using AND.
For Example:
dv.RowFilter = "Manufacturer='" & Trim(SearchManu.Text) & "'" & _
" AND SoftwareName='" & Trim(SearchSoft.Text) & "'"
You can also use the LIKE keyword combined with the asterisk (*) to perform a wildcard search.
In other words, the RowFilter property of a dataView should be set equal to a valid SQL WHERE clause.
 
Back
Top