CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    1

    advanced search form

    Could someone please lead me in the right direction? I'm trying to create an advanced search form using ASP which searches an SQL db. The form has 7 seven different criteria which can be searched, but only one is required to get results. Not sure how to pass the variables to ASP and have it search the DB with one or only a few of the requirements. Thank you!

  2. #2
    Join Date
    Oct 2002
    Location
    Malmoe Sweden
    Posts
    36
    You have to make the options as boolean (true or false), then in the receiving function (or page) make a some if..then statementsthat forms the sql-query.
    sql = "SELECT * FROM myTable where "

    If option1=true then
    sql = sql & "searchColumn = keyword"
    end if

    If option2=true then
    sql = sql & " And searchColumn2 = keyword"
    end if

    .......
    .......
    ......
    then pass the string to Sql server.........


    Staffy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured