Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Search question?

Reply
Thread Tools

Search question?

 
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      05-26-2005
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
 
Reply With Quote
 
 
 
 
Ben
Guest
Posts: n/a
 
      05-26-2005
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" <> wrote in message
news:29339EE7-4179-4F11-A23A-...
> 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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RWx0b24gVw==?=
Guest
Posts: n/a
 
      05-26-2005
Hi Rudy,

If you want 'any color', it should look like

SELECT ProductName FROM ProdTbl WHERE Color LIKE '%'

HTH

Elton Wang






"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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
| SEO , Search Engine Optimizer, SEARCH OPtiMIzAtIoN with SeaRch OPtiMizer optimizer.seo@gmail.com Digital Photography 0 04-22-2007 04:20 AM
Google search result like site search!! How? =?Utf-8?B?TGFrc2htaSBOYXJheWFuYW4uUg==?= ASP .Net 3 05-06-2005 02:08 AM
removing search engines from the search bar whatever.or.not@gmail.com Firefox 1 02-17-2005 12:06 PM
Search Bar not displaying search Engines Zimran Douglas Firefox 1 01-07-2005 02:30 PM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57