Search engine (mobile device)

tofuyan

Member
Joined
Mar 16, 2005
Messages
8
Programming Experience
Beginner
Hi,
I would like to know how to have an engine search in my application.



  • the user have to enter the object
Eg: 1) the user type book in the textbox
2) press the button Go,
3) it will search the SQL database and show a list of result regarding the word book.


Anyone can help? Any sample, code?

Thanks!!!
 

eagle

Active member
Joined
Mar 8, 2005
Messages
28
Programming Experience
1-3
Regular expressions

I think the best way to do this is use "regular expressions". Than you can look for the matches in the database, and show them.
 

tofuyan

Member
Joined
Mar 16, 2005
Messages
8
Programming Experience
Beginner
eagle said:
I think the best way to do this is use "regular expressions". Than you can look for the matches in the database, and show them.

Don't really understand!
 

eagle

Active member
Joined
Mar 8, 2005
Messages
28
Programming Experience
1-3
regular expressions

Oké, here is a little example, hope this clears things up a bit


moDA.Open() 'Open database connection

Dim sZoeken As String

sZoeken = txtZoeken.Text ' Search value

Dim arlPlanten As ArrayList = moDA.getPlanten 'Get all the possibilties you want to search through

Dim oPlant As clsPlanten

Dim arlResultaten As New ArrayList

Dim oRegExp As New System.Text.RegularExpressions.Regex(".*" & sZoeken & ".*", System.Text.RegularExpressions.RegexOptions.IgnoreCase)

Dim oMatches As System.Text.RegularExpressions.MatchCollection

Dim oMatch As System.Text.RegularExpressions.Match

Cursor.Current = Cursors.WaitCursor

'So you want to check for each value if it matches you search string
For Each oPlant In arlPlanten

For Each oMatch In oRegExp.Matches(sNaam)
MessageBox.Show(oMatch.Value, "Zoekresultaat") 'This will return the values that answer to your search result

Next

Next

I hope this helps
 
Top Bottom