📄 recalccart.asp
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<!-- #INCLUDE FILE="odbc_connection.inc" -->
<%
on error resume next
'====================
'Add to Shopping Cart
'====================
intSessionID=Session.SessionID
for each item in request.form
intQuantity=request.form(item)
strProductID=item
Set RS = Server.CreateObject("ADODB.Recordset")
if intQuantity=0 then
'this Product ID already exists in our cart... change qty
sSQL="DELETE * FROM tbl_ShoppingCart "
sSQL=sSQL & "WHERE (s_Item_No='" & strProductID & "' AND intSessionID=" & intSessionID & ")"
else
'this Product ID already exists in our cart... change qty
sSQL="UPDATE tbl_ShoppingCart "
sSQL=sSQL & "SET tbl_ShoppingCart.intQuantity=" & intQuantity & " "
sSQL=sSQL & "WHERE (s_Item_No='" & strProductID & "' AND intSessionID=" & intSessionID & ")"
end if
RS.Open sSQL, conn , 3, 2 'write
next
'check size of shopping cart
sSQL="SELECT intSessionID, intQuantity "
sSQL=sSQL & "FROM tbl_ShoppingCart "
sSQL=sSQL & "WHERE (intQuantity>0 AND intSessionID=" & intSessionID & ")"
RS.Open sSQL, conn , 3, 3 'read
RS.movelast
Rows=RS.recordcount
RS.close
if Rows>0 then
'====================
'move to ShowCart.asp
'====================
response.redirect "ShowCart.asp"
else
'================================================
'cart empty...go back to inventory.asp
'================================================
response.redirect "inventory.asp"
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -