Search SQL Database

Posted on 2005-04-05
Medium Priority
Last Modified: 2010-04-25
Hi Everyone

I have 3 combo boxes within a Form, a user can select an option from any number of these combo boxes, (e.g they can select the first one and the second one, only the first one, all 3 or the 2nd and 3rd one etc).

How do I code this in ASP vbscriptso that the database will display results based on these search parameters. I can easily do if the user had to select an option from all 3 but I don't know how to do it if the user selects 1-2 boxes.

Using sql server and asp vb

Any help would be great



Question by:patelajk
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

alexhogan earned 252 total points
ID: 13708817
You will probably want to use a "Select Case" statement.

If you set the "Select Case" to "True", then you can set each case as a parameter of either 1,2 or 3.  Where the first case is a query with one drop down selection.  The second case has two drop down selections and the third, three.

When the form is processed you can loop through the post data to see how many drop downs were used based on the object names.
LVL 53

Assisted Solution

by:Ryan Chong
Ryan Chong earned 248 total points
ID: 13709590
The tricks will be always make the 1st item's value in drop down with empty value, and then when the user submit the form, we'll check the request object for the drop-down menus, if the request object for the a drop down is not empty, we then add the selected value as a part of our query statement. Basically, 3 "IF" statements are using to construct the sql statement that will display the results later...

Get the idea? Anyway, you can always post your currently scripts available, so that we can try to justify it for you, regards
LVL 20

Expert Comment

ID: 13710573
I believe this would be aswered better in the ASP.NET section, you could have it reposted there.. :o)

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question