Hi,
I am making an ASP shopping cart site and Ive used data valadation to check that valid quantities are in an "update quantities" input box. But when I hit the update quantities button I get:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "1, 2"]'
/asp/qtyupd.asp, line 21
Ive pasted the code to the stated file qtyupd.asp incase you can see anything I need to change in there:
<%
Response.Cookies("modified") = "true"
Response.Expires=0
queries = 0
Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open ("driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("aspcart5.mdb"))
sql = "SELECT * FROM temporary ORDER BY item;"
set rs = Conn.Execute(sql)
do while not rs.eof
customerid= Request.Cookies("customerid")
If Request.Querystring(rs("item")) <> rs("quantity") and rs("custID") = Request.Cookies("customerid") then
newquantity = Request.QueryString("item")
Response.write(newquantity)
if newquantity = 0 then
sql = "DELETE DISTINCTROW custID FROM temporary WHERE (item='" & rs("item") & "')"
else
sql = "UPDATE DISTINCTROW temporary SET quantity ='" & newquantity & "' WHERE item='" + rs("item") + "' AND custID='" + customerid + "'"
end if
set rs = Conn.Execute(sql)
sql = "SELECT * FROM temporary ORDER BY item;"
set rs = Conn.Execute(sql)
end if
if not rs.eof then rs.movenext
loop
rs.close
set rs = nothing
Response.Redirect("refview.asp")
%>
I am making an ASP shopping cart site and Ive used data valadation to check that valid quantities are in an "update quantities" input box. But when I hit the update quantities button I get:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "1, 2"]'
/asp/qtyupd.asp, line 21
Ive pasted the code to the stated file qtyupd.asp incase you can see anything I need to change in there:
<%
Response.Cookies("modified") = "true"
Response.Expires=0
queries = 0
Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open ("driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("aspcart5.mdb"))
sql = "SELECT * FROM temporary ORDER BY item;"
set rs = Conn.Execute(sql)
do while not rs.eof
customerid= Request.Cookies("customerid")
If Request.Querystring(rs("item")) <> rs("quantity") and rs("custID") = Request.Cookies("customerid") then
newquantity = Request.QueryString("item")
Response.write(newquantity)
if newquantity = 0 then
sql = "DELETE DISTINCTROW custID FROM temporary WHERE (item='" & rs("item") & "')"
else
sql = "UPDATE DISTINCTROW temporary SET quantity ='" & newquantity & "' WHERE item='" + rs("item") + "' AND custID='" + customerid + "'"
end if
set rs = Conn.Execute(sql)
sql = "SELECT * FROM temporary ORDER BY item;"
set rs = Conn.Execute(sql)
end if
if not rs.eof then rs.movenext
loop
rs.close
set rs = nothing
Response.Redirect("refview.asp")
%>