0

I have already search box in my website but I need to allow the mistake spelling to search like this: if one person write (pineapel) it means (pineapple). I want him to find the (pineapple) in the data base

any help? thank you in advance

this code works to find word in sentence in table sqlserver:

SqlDataSourceArticles.SelectCommand = "SELECT [id], [articleid], [title], [description], [imageurl], [date], [type] FROM [articles] WHERE ([title] LIKE '%' + @title + '%') ORDER BY [imageurl] DESC"

Note: @title is the session from the text box to the search page result

Abbas
  • 14,186
  • 6
  • 41
  • 72
isacnour
  • 1
  • 2
  • 2
    You can do this much more neatly with a stored procedure. All you'd need to do is pass your search parameter. – Alec. Nov 17 '14 at 15:08
  • 1
    Perhaps this question: [How does the Google “Did you mean?” Algorithm work?](http://stackoverflow.com/questions/307291/how-does-the-google-did-you-mean-algorithm-work) might help. – Tea With Cookies Nov 17 '14 at 15:10

1 Answers1

0

You could use SQL's SOUNDEX() function to finds words based on their sound, not spelling.

WHERE (SOUNDEX([title]) = SOUNDEX(@title)) 
Steve
  • 5,585
  • 2
  • 18
  • 32