#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    63
    Rep Power
    12

    Keyword Search Problem


    Hi guys,

    I'm having a small problem with a keyword search not functioning correctly.

    Here's the scenario .... I'm using ASP in DWMX, with Access 2000 and am simply using a multiple search page where the user can select various options or just one option. One of these boxes is a keyword box named 'Des' (for description) This is named the same in the database.

    On the results page I have a recordset and have set up my variables. One variable is called sSchool which refers to simply a drop down on the search page and the other is the sDes variable which refers to a text box for entering keywords. The variable code for the keyword field is ...

    name = sDes
    default value = %how%
    runtime value = request.form("Des")

    My SQL in the advanced box is....

    SELECT *
    FROM Links
    WHERE Des LIKE 'sDes' AND School LIKE 'sSchool'

    I have tried modifying this, mainly in the default value column i.e. just having % but still no luck.

    The School bit works fine, just not he keyword bit.

    Any ideas where I'm going wrong??

    Any help would be much appreciated as I've spent hours!!!

    Appologies if this is slightly in the wrong forum area, but wasn't quite sure where best to put it.

    Thanks in advance

    Jon
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Melbourne, Australia
    Posts
    212
    Rep Power
    12
    try the following

    Code:
    Dim querystring
    querystring = "SELECT *FROM Links WHERE Des LIKE '%" & sDes & "%' AND School LIKE '%" & sSchool & "%'"
    How can I soar like an eagle when
    I'm flying with turkey's?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    63
    Rep Power
    12

    Thanks for the reply....


    I've managed to sort it now.

    I tried using your line of code but is didn't seem to like the use of the '%" bits for some reason. Which is odd as I'm sure I have used that expression before in a previous project.

    Anyways if you interested, here's my final SQL code...

    SELECT Created, Des, Title, School, Language
    FROM Links
    WHERE School LIKE 'varSchool' AND Language LIKE 'varLanguage' AND (Des LIKE '%varSearch%' OR Title LIKE '%varSearch%')

    Thanks again

    Jon
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Melbourne, Australia
    Posts
    212
    Rep Power
    12
    glad you got it sorted
    How can I soar like an eagle when
    I'm flying with turkey's?

IMN logo majestic logo threadwatch logo seochat tools logo