K
Kevin993
Guest
Greetings,
Here is a description of the searching method I'm working on:
If the input string has spaces in it, like "Good Car", Then I want to search for each of the words and filter the results together.
That means :
First, "Good" is searched in whole the dataset table's rows , then if found, corresponding rows are filtered.
Second, "Car" is searched only in the filtered rows (previous step), then if found, corresponding rows are filtered again. It should continue filtering till all the words are searched (I can do it with a For... Next that loops through words count).
So if our input for search is : "Good Car" , and the item being searched is : "Good blue Car", It should filter this item as Good and Car are searched and filtered.
Here is what I wrote :
Dim ls As List(Of String) = Split(TextBox1.Text, " ").ToList
For Each wordd In ls
For Each row As DataRow In ds.Tables("Table1").Select("Sname Like '%" & wordd & "%' ")
' Need to keep the filtered rows somewhere like a new table in dataset
Next row
Next
P.S, I fill my dataset using OleDbDataAdapter :
Dim cmd As OleDbCommand = New OleDbCommand("SELECT ID, Sname FROM Table1", con)
con.Open()
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
ds = New DataSet()
myDA.Fill(ds, "Table1") 'Fill DataSet object with data
Continue reading...
Here is a description of the searching method I'm working on:
If the input string has spaces in it, like "Good Car", Then I want to search for each of the words and filter the results together.
That means :
First, "Good" is searched in whole the dataset table's rows , then if found, corresponding rows are filtered.
Second, "Car" is searched only in the filtered rows (previous step), then if found, corresponding rows are filtered again. It should continue filtering till all the words are searched (I can do it with a For... Next that loops through words count).
So if our input for search is : "Good Car" , and the item being searched is : "Good blue Car", It should filter this item as Good and Car are searched and filtered.
Here is what I wrote :
Dim ls As List(Of String) = Split(TextBox1.Text, " ").ToList
For Each wordd In ls
For Each row As DataRow In ds.Tables("Table1").Select("Sname Like '%" & wordd & "%' ")
' Need to keep the filtered rows somewhere like a new table in dataset
Next row
Next
P.S, I fill my dataset using OleDbDataAdapter :
Dim cmd As OleDbCommand = New OleDbCommand("SELECT ID, Sname FROM Table1", con)
con.Open()
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
ds = New DataSet()
myDA.Fill(ds, "Table1") 'Fill DataSet object with data
Continue reading...