Hello all!
I posted this question on the SQL boards, got some great answers, but I
thought I would also try here, since I'm using asp.net/vb.net.
I'll try to lay this out a simple as possible. I think before I was
approaching it the wrong way.
I have 3 ddl's that have values from my database. ddlSize, ddlColor and
ddlStyle.
If a user wants to search for a product, they select the following, "Small,
Red, Sportsman". So all the products that match this will show up.
But if the user selected "Small, Red, and then 'Any' from ddl style. It
should show all products that are Red and Small, but all Styles. Or if all
three were selected "Any", then it should show everything.
So my question is how can I write my SQL to say "SELECT ProductName AS
FROM ProdTbl
WHERE Color = *"
I know I can't use *, it doen't work. So I just want if "Any" is selected,
it will pick everthing.
Or maybe there is a beter way to do this. I'm thinking about job sites that
have search engines, select any job, or all job, or all locations. Giving the
user the ability to see all the products, or maybe to see all red products.
I hope this make sence, thank for your help!!
Rudy 2 955
I wouldn't use a where condition if 'any' is the selected option. If you
must, you could do something cheesy like Color = blah OR 1 = 1...
"Rudy" <Ru**@discussions.microsoft.com> wrote in message
news:29**********************************@microsof t.com... Hello all!
I posted this question on the SQL boards, got some great answers, but I thought I would also try here, since I'm using asp.net/vb.net. I'll try to lay this out a simple as possible. I think before I was approaching it the wrong way. I have 3 ddl's that have values from my database. ddlSize, ddlColor and ddlStyle. If a user wants to search for a product, they select the following, "Small, Red, Sportsman". So all the products that match this will show up. But if the user selected "Small, Red, and then 'Any' from ddl style. It should show all products that are Red and Small, but all Styles. Or if all three were selected "Any", then it should show everything. So my question is how can I write my SQL to say "SELECT ProductName AS FROM ProdTbl WHERE Color = *" I know I can't use *, it doen't work. So I just want if "Any" is selected, it will pick everthing. Or maybe there is a beter way to do this. I'm thinking about job sites that have search engines, select any job, or all job, or all locations. Giving the user the ability to see all the products, or maybe to see all red products.
I hope this make sence, thank for your help!!
Rudy
Hi Rudy,
If you want 'any color', it should look like
SELECT ProductName FROM ProdTbl WHERE Color LIKE '%'
HTH
Elton Wang el********@hotmail.com
"Rudy" wrote: Hello all!
I posted this question on the SQL boards, got some great answers, but I thought I would also try here, since I'm using asp.net/vb.net. I'll try to lay this out a simple as possible. I think before I was approaching it the wrong way. I have 3 ddl's that have values from my database. ddlSize, ddlColor and ddlStyle. If a user wants to search for a product, they select the following, "Small, Red, Sportsman". So all the products that match this will show up. But if the user selected "Small, Red, and then 'Any' from ddl style. It should show all products that are Red and Small, but all Styles. Or if all three were selected "Any", then it should show everything. So my question is how can I write my SQL to say "SELECT ProductName AS FROM ProdTbl WHERE Color = *" I know I can't use *, it doen't work. So I just want if "Any" is selected, it will pick everthing. Or maybe there is a beter way to do this. I'm thinking about job sites that have search engines, select any job, or all job, or all locations. Giving the user the ability to see all the products, or maybe to see all red products.
I hope this make sence, thank for your help!!
Rudy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: siliconmike |
last post by:
I'm working on a new project with php & mysql.
I anticipate that one of the tables may grow above 40 GB in a short
time. The main content is text. Now what tools do I need to implement a
text...
|
by: Greg |
last post by:
I have a page that searches a database by a repairman's name and by a
date range. It pulls info by the repairman's name but pulls all info in
the database regardless of the date. Below is the code...
|
by: Paul Rubin |
last post by:
I have a string s, possibly megabytes in size, and two regexps, p and q.
I want to find the first occurence of q that occurs after the first
occurence of p.
Is there a reasonable way to do it?...
|
by: Steve K |
last post by:
After reading Harlan's post about popups some of my questions were
answered but..
I was going to use differnet popups on a lot of my pages. These popups
contain bios on Cornell faculty. Two days...
|
by: Dave Townsend |
last post by:
Hi,
Can anybody help me with the following piece of code?
The purpose behind the code is to parse HTML files, strip out
the tags and return the text between tags. This is part of a larger...
|
by: Laszlo Nagy |
last post by:
Hi,
I'm using imaplib to access an IMAP4 server. I'm reading the IMAP4
specification, and I found something odd. The search command can be
used in conjuction with date values. For example, I...
|
by: MrWelfare |
last post by:
Hi Everyone,
I'm currently trying to follow an example I found in a book a while ago to try to create a spotlight (mac-like) search that filters results as one types. The script that I have works...
|
by: Skywick |
last post by:
Hi
I am trying to do a full text search with a column name for the search term.
I can do this using LIKE with:
SELECT tblContent.ID FROM tblContent INNER JOIN #keywords ON tblContent.words...
|
by: yeshello54 |
last post by:
hello. I have a question about my search function in my php page. I have a search function that when the user types the ID# in it will return all the data from the database connected to that id#. My...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |