Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Aug 12, 1999



Application Security Testing: An Integral Part of DevOps

Search a Database on Partial String Matches

I have a database hooked up to my Web page. I can do a search and it works fine, but during my search, if I spell a word wrong, it will not return anything. How do I make it possible to search on a part of the input? For example, I want to be able to type (zz) and not (zz top) and get all the fields that have zz in them.


In your SQL Statement where you are doing the search, instead of saying:

WHERE [field] = 'value'

Try saying:

WHERE [field] = '%value%'

This code is valid for SQL Server. If you are using Access, you need to use '*value*'.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date