Results 1 to 4 of 4

Thread: ASP Error

  1. #1
    Join Date
    Oct 2002
    Posts
    4

    Unanswered: ASP Error

    Hello,

    I am recieving the following error message:

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
    /im250/addCart.asp, line 76


    Now this is line 76:

    SET RS = Con.Execute( sqlString )

    With lines 68-75 as follows:

    <%
    ' Get the shopping cart
    sqlString = "SELECT cart_id, product_name, " &_
    "product_price, cart_quantity " &_
    "FROM cart, products " &_
    "WHERE cart_userID=" & userID & " " &_
    "AND cart_productID = product_id " &_
    "ORDER BY cart_id DESC"

    I am new to ASP and have been stuck on this error for quite awhile now. It is using a MSAccess database also. Do I have to change the code or is it something to do with my connection? I would be very grateful for any help or ideas!

    Thank You.

    Arif.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Sorry, I did not see this post until today, so you may have already found the mistake.

    You did not separate the product_id out of the string.

    "WHERE cart_userID=" & userID & " " &_
    "AND cart_productID =" & product_id & " " &_
    "ORDER BY cart_id DESC"

    Let me know if you need help.

  3. #3
    Join Date
    Oct 2002
    Posts
    4
    After i separated product_id out of the string, i am now getting the following error message:

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'cart_userID=1 AND cart_productID='.
    /im250/addCart.asp, line 76

    Now cart_userID is an autonumber field and therefore is ciorrect at '1'. Whereas cart_productID is a number field which should contain the product_id of the product contained in the cart.

    I have 'played' around with the code but still receive error messages because i think it is to do with the syntax of the code, right!? Could anyone please help me?

    Many thanks

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    Your product_id variable is hosed - do a response.write with the product_id with some text around it and see if a value exists. The error is leading me to believe that product_id is empty (or hosed).

Posting Permissions

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