PDA

View Full Version : ASP Error


arif
10-16-02, 19:45
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.

rnealejr
10-22-02, 01:59
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.

arif
10-23-02, 17:50
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

rnealejr
10-23-02, 18:25
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).