Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    4

    Unanswered: Problems SELECTing records

    I'm creating an ASP site that accesses a database full of product descriptions, and this particular page shows all the products from a certain category. it doesn't work at the moment, because of something to do with the "WHEre Category=" part. The category names are in the format "13 - Tooling Storage Carts" when i start the page, i get an error message of either

    Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

    or

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Category=01 - Quick Disconnects'.

    depending on the number of words in the category i send to the page.


    here is the code:

    <%
    Dim SQL, Connect, OnSubCat, ThisCategory, Query
    Set Connect = Server.CreateObject("ADODB.Connection")
    Connect.Open "WebsiteProductData"
    ThisCategory = Request.Querystring("Category_Name")



    Query = "SELECT DISTINCT Sub_Category, Category FROM ItemMasterPriceData WHERE Category=" & ThisCategory & " "


    Set OnSubCat = Connect.Execute(Query)

    %>


    what gives?

    thanks in advance.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    You need to insert single quotes around the part you are trying to retrieve.

    Query = "SELECT DISTINCT Sub_Category, Category FROM ItemMasterPriceData WHERE Category='" & ThisCategory & "' "

Posting Permissions

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