p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Databases (http://p2p.wrox.com/forumdisplay.php?f=62)
-   -   Search Does not go beyond 1st word in field (http://p2p.wrox.com/showthread.php?t=23131)

phungleon December 27th, 2004 04:45 PM

Search Does not go beyond 1st word in field
 
Hi All,

I have 2 fields in SQL 2000 Database, called "Fields_of_interest" and "Name." Users input their data into them. What I want to do is be able to search on the "fields_of_interest" field. So for example, I have two records inputed.

Name: Fields_of_interest:
Leon security, IT, programmer
John security, accounting,

Here is the problem. In an ASP "search" page that I have created, when I do a search, I can ONLY search on the first word of the "Fields_of_interest" field. In other words, let say I want to search for someone who is interested in Accounting. I will get a NO record result, because the query is not looking for anything beyond the first word in the field. Any idea why it is doing this? Below is my query.

mySQL="SELECT ApplicantID, firstname, lastname, email, start_date, end_date, fields_of_interest, academic_level, academic_goals, career_goals FROM internship_form where isArchive=1"

mySQL=mySQL & " AND fields_of_interest like '" & fields_of_interest & "%'"

shahchi1 December 27th, 2004 06:10 PM

Try this:

mySQL="SELECT ApplicantID, firstname, lastname, email, start_date, end_date, fields_of_interest, academic_level, academic_goals, career_goals FROM internship_form where isArchive=1"

mySQL=mySQL & " AND fields_of_interest like '%" & fields_of_interest & "%'"

phungleon December 27th, 2004 08:11 PM

Hey Shahchi1, this work! thanks!

Leon



All times are GMT -4. The time now is 04:01 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.