Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP and database search

Options
  • 18-07-2003 11:17am
    #1
    Registered Users Posts: 8,053 ✭✭✭


    Loa folks hope you can help :)

    Kinda hard to explain so excuse me if this is a bit all over the place.

    ive made 2 html forms. A text field and a list field.

    The text field allows the user to input a search parameter (eg 'The') and the list field allows them to search within a certain cloumn of the database(eg 'Title'). I have gotten it working so far that if 'The' is the first word (or part of the first word) that it will return those records. (eg will return records starting with The, Their, Then etc),
    however it doesnt return any records with 'the' in the middle of it.
    (eg ' a look at the atmosphere' etc)

    Im using ASP with VBScript.
    database im using is MS access 2000

    atm i have this:
    strSQL= "Exec " & strwhere & " " & strSearch

    objRS.open strSQL, objConn

    I've also tried using stored procedures but this didn't change a thing.
    What would i need to change to get it to return all the records with the search word any where within that record.

    Thanks for any help.

    EDIT: im not sure if the code above works any more, just tried it again after messing about a bit and its gone again buy you get the general idea of what im looking for i hope :)


Comments

  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    Can you post up the raw sql query

    strSQL= "Select strwhere from table_name where field_name LIKE" & " %" & strSearch & "%"


  • Registered Users Posts: 8,053 ✭✭✭BKtje


    /me slaps head

    I've got it working now thanks Bazh all i needed to do (as you wrote) was but a % before the query as well. I feel so stupid.
    This has been annoying me for nigh on 2 days and you fix it in a minute.

    Thanks, highly appreciated

    (also code in the quotes above never worked, i pasted the wrong one but nm that now)


  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    Can you forward the address and name to whom i should make the bill out too. ;)

    -= Case Closed =-


  • Registered Users Posts: 8,053 ✭✭✭BKtje


    sure thing (/me ponders who ill send bill too....)

    sure send it to Benji he owes me one :p


  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    -= Case Closed =-

    :cool:


  • Advertisement
  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    select upper(blah) from blah where term=upper(criteria);


Advertisement