Q

How do I create a wildcard search in my database program?

I'm building a SQL database program to search for names or numbers. I know how to get the exact name or number. But I would like to use a wildcard to show everything starting with "the first few letters" or "the first few numbers." I'm using OleDBDataAdapter to access my database. (VB.NET)
Use SQL "LIKE" keyword together with the "%" wildcard. For example: SELECT * FROM authors WHERE fname LIKE 'J%' (will give you John and Jason) SELECT * FROM authors WHERE telephone LIKE '54%' (will give you all lucky authors living in Argentina -- such as myself!)
This was last published in June 2003

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close