Click to See Complete Forum and Search --> : advanced search form


dachamp03
February 10th, 2003, 01:19 PM
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!

Staffy
February 20th, 2003, 02:30 AM
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