View Single Post
Old 01-04-2013, 02:43 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
You really should move that inline SQL to at least the code behind; preferably to a stored proc... either way the correct syntax (without knowing your database structure that is) would be
Code:
SELECT * 
FROM [Products] 
WHERE [Brand] = @Brand 
          AND [Colour] = @Colour 
          AND [Price] BETWEEN @LoNumber AND @HiNumber
so you need to figure out how to split the 'value' into usable numbers. You can pass this to a stored proc easily
Code:
CREATE PROC usp_getProducts
     @Brand varchar = null,
     @Colour varchar = null,
     @LoNumber int = null,
     @HiNumber int = null,
AS
SELECT * 
FROM [Products] 
WHERE [Brand] = @Brand 
          AND [Colour] = @Colour 
          AND [Price] BETWEEN @LoNumber AND @HiNumber
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote