Search Page

Discussion in 'ASP General' started by J P Singh, Nov 18, 2003.

  1. J P Singh

    J P Singh Guest

    Hi All

    I have been asked to build a search page to allow users to search the
    database. The issue is that the search page in ASP must mirror out existing
    search screen on the VB application.

    I need to give a search screen which will have lots of dropdowns and free
    text fields. I want to dynamically build a search query to include fields
    that the user chooses to enter something in.

    For example I might have fields like this on form

    Name
    Area
    EmpNumber
    Gender
    Postcode

    The user enters name and postcode

    I would like to create a query like this

    Select * from info where name like request.form("Name") and Postcode like
    request.form(Postcode)

    but if the user only entered his name the query should be

    select * from info where name like request.form("Name")

    does anyone know how this can be done.

    cheers

    Jas
     
    J P Singh, Nov 18, 2003
    #1
    1. Advertising

  2. J P Singh

    Ray at Guest

    You can check to see which fields were filled out by getting the value
    beforehand.


    Dim bName, bPostcode
    bName = Trim(Request.Form("name")) <> ""
    bPostcode = Trim(Request.Form("postcode")) <> ""

    Then build your sql query based on the boolean values.

    Ray at work


    "J P Singh" <noemail@asIhatespam> wrote in message
    news:...
    > Hi All
    >
    > I have been asked to build a search page to allow users to search the
    > database. The issue is that the search page in ASP must mirror out

    existing
    > search screen on the VB application.
    >
    > I need to give a search screen which will have lots of dropdowns and free
    > text fields. I want to dynamically build a search query to include fields
    > that the user chooses to enter something in.
    >
    > For example I might have fields like this on form
    >
    > Name
    > Area
    > EmpNumber
    > Gender
    > Postcode
    >
    > The user enters name and postcode
    >
    > I would like to create a query like this
    >
    > Select * from info where name like request.form("Name") and Postcode like
    > request.form(Postcode)
    >
    > but if the user only entered his name the query should be
    >
    > select * from info where name like request.form("Name")
    >
    > does anyone know how this can be done.
    >
    > cheers
    >
    > Jas
    >
    >
     
    Ray at, Nov 18, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TGFrc2htaSBOYXJheWFuYW4uUg==?=

    Google search result like site search!! How?

    =?Utf-8?B?TGFrc2htaSBOYXJheWFuYW4uUg==?=, May 5, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    701
    Lucas Tam
    May 6, 2005
  2. Andy
    Replies:
    1
    Views:
    369
    Jack Klein
    Nov 25, 2003
  3. Anand Pillai

    String search vs regexp search

    Anand Pillai, Oct 12, 2003, in forum: Python
    Replies:
    10
    Views:
    608
    Anand Pillai
    Oct 15, 2003
  4. Abby Lee
    Replies:
    5
    Views:
    443
    Abby Lee
    Aug 2, 2004
  5. sancha
    Replies:
    0
    Views:
    114
    sancha
    Aug 5, 2005
Loading...

Share This Page