query in searching a word or a phrase in access

srivalli

Well-known member
Joined
May 4, 2005
Messages
189
Programming Experience
Beginner
i enter some data in access using front end.

what do i do for searching a word or a phrase in access using vb.net or asp.net .
better if quick response is given.
thank u
 
Use the SQL command LIKE in a WHERE clause.
This code will search a column called product_desc for any values that contain the word "electronic"
VB.NET:
Me.OleDbSelectCommand.CommandText = "SELECT * FROM table_name WHERE firstname LIKE '%electronic%'"

However, lets say you wanted to return words that started with a certain letter(s), your query would be
VB.NET:
SELECT * FROM table_name WHERE column_name LIKE 'b%'
Any word in column_name that began with a b would be extracted.

On the other hand, if you wanted to return words that ended with a certain letter your query would be
VB.NET:
SELECT * FROM table_name WHERE column_name LIKE '%t'
For example that query would return words like: cat, hat and flat

Hope This Helps
 
Back
Top