maybe there is a simple answer to my problem:
I have a mssql table ('Person') with a field for first and one for last name. I am coding a Program, where the User should be able to search for persons.
SELECT id, firstname, lastname FROM Person WHERE firstname LIKE @searchstring + '%' OR lastname LIKE @searchstring + '%'
doesn't work very well, because if the user types 'John W' nothing is found.
For example the person I search for is called John Williams: It should work with searchstrings like 'John W', 'Williams Jo', 'Will' or 'Joh'
Concatenating first and lastname and use %Searchstring% also doesn't work well, because if the searchstring is e.g. 'Will' it should find people who are called Will, Willibald, Williams or Willson or something like that, but not a Person called Goodwill e.g.
And the query should be as fast as possible, because it is executed at every keydown...
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire