Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keyword Search

Status
Not open for further replies.

tonyfitz

Technical User
Mar 25, 2003
13
0
0
IE
What code do I require to run a keywrod search in asp?

I have a table of employee resumes. I want to query all fields in the table by keyword and retrieve all records that match the keyword.

Can anyone help

Regards

Tony
 
Hi ….
Your key word needs to be in a variable and the statement would look something like this.
Search_Var = “RPG”

SELECT Field1, Field2, Field3
FROM Tab_Name
WHERE
Field1 LIKE “’*” & Search_Var & “*’”
OR
Field2 LIKE “’*” & Search_Var & “*’”
OR
Field3 LIKE “’*” & Search_Var & “*’”

The * is a wildcard symbol and it different from database to database type. Check to see what Access uses. Don’t forget any string needs a single quote around it.

Regards,
John


*********************
John Nyhart
*********************
 
This is from a PHP \ MySQL application of mine but it should be easy to adapt it for your own purposes.

SELECT * FROM contacts WHERE name LIKE '%$keyword%'
OR telephone LIKE '%$keyword%' OR fax LIKE '%$keyword%'
OR email LIKE '%$keyword%' OR address LIKE '%$keyword%'
OR website LIKE '%$keyword%' OR comments LIKE '%$keyword%'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top