Results 1 to 2 of 2

Thread: sql

  1. #1
    monireh Guest

    Default sql

    does anyone know why this code<BR>&#039 Add Item to cart<BR>IF productID &#060;&#062; "" THEN<BR> sqlString = "SELECT cart_id FROM cart " &_<BR> "WHERE cart_userID=" & userID & " " &_<BR> "AND cart_productID=" & productID<BR> SET RS = Con.Execute( sqlString )<BR> IF RS.EOF THEN<BR> sqlString = "INSERT INTO cart ( " &_<BR> "cart_userID, " &_<BR> "cart_productID, " &_<BR> "cart_quantity " &_<BR> ") VALUES ( " &_<BR> userID & ", " &_<BR> productID & ", 1 )"<BR> ELSE<BR> sqlString = "UPDATE cart SET " &_<BR> "cart_quantity=cart_quantity+1 " &_<BR> "WHERE cart_id=" & RS( "cart_id" ) <BR> END IF<BR> RS.Close<BR> SET RS = Nothing<BR> Con.Execute sqlString<BR>END IF<BR><BR>gives this error:<BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)<BR>[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.<BR>/Aspfiles/addCart.asp, line 11<BR><BR>thanks

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default SHOW QUERY

    We would like to see the value of "sqlString" just before it is executed. Cant make out much by looking at you BUILDING the query<BR><BR>cart_quantity=cart_quantity+1 --&#062; are you just increasing the currnet value in the DB by one here<BR><BR>does "RS( "cart_id" )" have a value when you do the UPDATE<BR><BR>This part i am not aboe to read properly give me the query<BR>INSERT INTO cart ( " &_<BR>"cart_userID, " &_<BR>"cart_productID, " &_<BR>"cart_quantity " &_<BR>") VALUES <BR>TRY this<BR>INSERT INTO cart (cart_userID, cart_productID, cart_quantity) values.... --&#062; check the syntax of the insert query.

Posting Permissions

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