search sql with multiple criteria (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


crosscreek -> search sql with multiple criteria (4/16/2008 21:53:13)

Working on a search form with multiple entries. I think I can create the asp code for this, but working on the SQL for the criteria inputted. (YES THE DOG DATABASE)

Example.

Search Form:

Color:
color factor:
location:
price range:

Results.asp

col = request.form("color")
factor = request.form("factor")
location = request.form("location")
price = request.form ("Price")

select * from tbldog where color = col AND factor = factor AND location = location And price = price.

I know how to make the SQL to match all the criteria inputted, but how do I handle if someone what's to find matches to part of the criteria.

Do I need to break up the code into several parts.

For example if someone wants to see all the dog that are located in Texas.

col = all
price = all
location = TX
factor = all

OR texas dog's that are chocolate factored

col = all
price = all
location = TX
factor = choc














rdouglass -> RE: search sql with multiple criteria (4/16/2008 23:02:03)

This thread is full of stuff - code and links - about doing what (I think) you want to do:

http://www.frontpagewebmaster.com/m-240541/key-on%252Dthe%252Dfly/tm.htm#240577

That help any?




crosscreek -> RE: search sql with multiple criteria (4/17/2008 11:45:23)

PERFECT [:D]

That's exactly what I needed to find out....




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
6.054688E-02