Advertisement

03.31.2004 at 11:23AM PST, ID: 20939097
[x]
Attachment Details

Search/results page w/ multiple parameters...sql query help needed!

Asked by EaglePress in Miscellaneous Web Development

Tags: one, sql, than

Greetings experts.
I have two .asp pages using vb script and developed w/ ultradev4.  I have one page named product_search.asp that allows the user to enter up to 4 parameters(client, product code, ink color, and stock name).  Text boxes on this page are named selectClient (drop-down list box), txtProductCode, txtInkColor, and txtStockName.  This page passes data via POST.

The second page product_results.asp is a table w/ a record set that is querying a SOLID db.  Here is my sql statement:
SELECT PRODUCTS.ID, PRODUCTS.PRODCODE, PRODUCTS.LONGNAME, PRODUCTS.STOCK_NAME, PRODUCTS.IMPRINT_COLOR,  PRODUCTS.BATCH_STYLE, PRODUCTS.AFT_PROD_CODE, CLIENTS.LONGNAME
FROM PRODUCTS INNER JOIN CLIENTS ON PRODUCTS.CLIENT = CLIENTS.CLIENT
WHERE PRODUCTS.CLIENT = 'varClient' OR PRODCODE = 'varProductCode' OR IMPRINT_COLOR = 'varInkColor' OR STOCK_NAME = 'varStockName'
ORDER BY PRODUCTS.CLIENT

varClient=sselectClient
varProductCode=txtProductCode
varInkColor=txtInkColor
varStockName=txtStockName

The query works but not like i need it too.  I can search w/ one parameter, say client name and return only results from the entered client name, but if i enter more than one search parameter the results are random.  Here is what i need the query to do.
If one paramerter is selected (client) then return all records for that client.
If two parameters are selected (client, product code) then return all records from that client that also has the product code.
If three parameters are selected (client, product code, ink color) then return all records from that client that also has the product code and ink color.
Get the idea? Basically the more parametes that are entered the fewer records returned.  Hope this makes sense.  Say I enter, client=Acme, product code=001, ink color=blue, stock name=white paper then maybe only 5 records are returned.  Whereas if i only entered client=Acme then 50 records are returned.
I am sure it is the way i have my sql statement configured but i surely cannot figure out what it should be.  Also if no parameters are entered then i would like for all records to be returned.  Thanks in advance.  200 points for this one.Start Free Trial
 
Loading Advertisement...
 
[+][-]03.31.2004 at 12:22PM PST, ID: 10726903

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2004 at 12:32PM PST, ID: 10726971

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2004 at 12:34PM PST, ID: 10726990

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Web Development
Tags: one, sql, than
Sign Up Now!
Solution Provided By: dgooding
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.31.2004 at 12:39PM PST, ID: 10727026

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2004 at 01:05PM PST, ID: 10727235

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2004 at 01:13PM PST, ID: 10727308

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2004 at 01:15PM PST, ID: 10727336

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2004 at 01:30PM PST, ID: 10727478

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2004 at 01:46PM PST, ID: 10727618

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 06:16AM PST, ID: 10732199

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 06:30AM PST, ID: 10732327

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 06:37AM PST, ID: 10732378

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 07:08AM PST, ID: 10732623

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 07:42AM PST, ID: 10732895

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 07:56AM PST, ID: 10732992

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 08:01AM PST, ID: 10733039

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 08:29AM PST, ID: 10733286

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 10:29AM PST, ID: 10734362

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 11:03AM PST, ID: 10734668

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 12:13PM PST, ID: 10735368

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 01:05PM PST, ID: 10735836

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2004 at 05:44PM PST, ID: 10737567

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.02.2004 at 07:00AM PST, ID: 10741079

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.02.2004 at 07:12AM PST, ID: 10741189

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2004 at 12:45PM PDT, ID: 10786588

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2004 at 12:53PM PDT, ID: 10786638

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2004 at 01:39PM PDT, ID: 10786980

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2004 at 01:49PM PDT, ID: 10787064

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2004 at 02:02PM PDT, ID: 10787159

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2004 at 02:10PM PDT, ID: 10787218

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2004 at 06:03PM PDT, ID: 10788727

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.09.2004 at 06:21AM PDT, ID: 10790985

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32