⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recalccart.asp

📁 不错的代码 看完后一定要留评论哦 有疑问联系我
💻 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 + -