Hello, I have a ListBox filled with names stored in an SQLite DB. If I digit the full name I’m able to filter it and see only the result, I’m wondering how to search by using a partial word (i.e. just 3 or 4 letters of the name). I read about MATCH and LIKE but could not apply them to my app.
dim PreparedForSearch as SQLPreparedStatementMBS = SQLiteIndexDBMBS.Prepare("SELECT docid FROM bodyindex WHERE messagebody MATCH ?")
PreparedForSearch.BindType(0, PreparedForSearch.kTypeString)
SearchString = ReplaceAll(SearchString, """", """""")
dim data as RowSet = PreparedForSearch.SelectSQLMT("'*'" + searchstring + "'*'")
If data <> Nil Then
While Not data.AfterLastRow
ResultIDs.Add data.Column("docid").StringValue
data.MoveToNextRow
Wend
data.Close
End If
Return ResultIDs
To get best results, please, provide a simple project with the data base that holds, say city names that ends like
dorf, Offendorf
city, ?
ville, Lunéville, Thionville, …
bourg, (Offenbourg/Offenburg, Strasbourg, Strasburg, …)
Heim, Vendenheim, Molsheim, Rosheim, Marlenheim
etc.
Google maps around Strasbourg (both France and Germany) will give you city names with these ending…
So we can run it and found (more or less) easilly a solution / advice…
Here’s the link to the file and the DB: Smash
Sorry it is in Italian but I followed your indication in using German towns.
I’m only interested in searching the right ListBox which, eventually, should be filled with names and ids (i.e. D1, D2,).
Thanks for any heòp
Yes, I am trying it and I also went along with the example in the help.
Doing exactly what the help says (changing names of the DB and tables, though) I get an error which I show in the picture.
Either I’m doing something wrong (most likely) or there is a glitch in the help