PDA

View Full Version : can someone help?



mazer
11 Feb 2006, 01:16 PM
I'm totally new to asp so any help with this would be greatly appreciated. I have a database table with around 8000 cards, at any one time there is about 5000 cards in stock, which means there is 3000 cards that are not in stock. The problem I have is that when a person search my web site all the cards that are'nt in stock show up in the search with the ones that are in stock, which is quite frustrating for people who don't have broadband.
The search consists of three dropdown boxes that let the user use different criteria to search for the cards that they are looking for. What I thought about doing was using the "WHERE" statement to select item where "Units in Stock" was more than 1

strQuery = "SELECT DISTINCT Description FROM Cards WHERE UnitsinStock = '>1';"
strQuery = "SELECT DISTINCT Description FROM Cards WHERE UnitsinStock > 1;"
But as you may have gathered this didn't work!
Below is the original code and you can view the search at the following address http://www.themazecomicstore.com/html/magic_the_gathering.asp

strQuery = "SELECT DISTINCT Description FROM Cards;"
Set objRS = objConn.Execute(strQuery)
dropdown(2) = "<SELECT SIZE=1 NAME=colour>"
While NOT objRS.EOF
dropdown(2) = dropdown(2) & "<OPTION>" & objRS("Description") & "</OPTION>"
objRS.MoveNext
Wend
dropdown(2) = dropdown(2) & "</SELECT>"

strQuery = "SELECT DISTINCT ProductType FROM Cards;"
Set objRS = objConn.Execute(strQuery)
dropdown(1) = "<SELECT SIZE=1 NAME=producttype>"
While NOT objRS.EOF
dropdown(1) = dropdown(1) & "<OPTION>" & objRS("ProductType") & "</OPTION>"
objRS.MoveNext
Wend
dropdown(1) = dropdown(1) & "</SELECT>"

strQuery = "SELECT DISTINCT ProductGroup FROM Cards;"
Set objRS = objConn.Execute(strQuery)
dropdown(0) = "<SELECT SIZE=1 NAME=productset>"
dropdown(0) = dropdown(0) & "<OPTION></OPTION>"
While NOT objRS.EOF
dropdown(0) = dropdown(0) & "<OPTION>" & objRS("ProductGroup") & "</OPTION>"
objRS.MoveNext
Wend
dropdown(0) = dropdown(0) & "</SELECT>"

JayDesigns
15 Feb 2006, 07:28 AM
strQuery = "SELECT DISTINCT Description FROM Cards WHERE UnitsinStock >= 1"



That should work. Your SQL syntax was wrong.