Results 1 to 2 of 2

Thread: can someone help?

  1. #1
    Join Date
    Jan 2006
    Posts
    1

    can someone help?

    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
    Code:
    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/htm..._gathering.asp
    Code:
    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>"

  2. #2
    Join Date
    Jun 2004
    Location
    London, UK
    Posts
    172
    Code:
    strQuery = "SELECT DISTINCT Description FROM Cards WHERE UnitsinStock >= 1"

    That should work. Your SQL syntax was wrong.
    ________________
    JayDesigns.co.uk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •