xt_orderform_editquantities.asp
来自「用ASP写的电子购物系统」· ASP 代码 · 共 68 行
ASP
68 行
<%@ LANGUAGE=vbscript %>
<% Response.ExpiresAbsolute=#Jan 01, 1980 00:00:00# %>
<% REM ######################################################################### %>
<% REM %>
<% REM xt_order_editquantities.asp %>
<% REM 修改购物篮数量 %>
<% REM %>
<% REM Copyright (c) 1996-98 EPRO Corporation. All rights reserved. %>
<% REM %>
<% REM ######################################################################### %>
<!--#INCLUDE FILE="include/shop.asp" -->
<!--#INCLUDE FILE="include/util.asp" -->
<%
dim errorList
For i = 1 to Request("quantity").count
q=checknum(Request("quantity")(i),3)
if isnull(q) then
errorList=errorList & "数量为1到3位正数。<br>"
else
if formatnumber(q,0)<=0 then
errorList=errorList & "数量为1到3位正数。<br>"
end if
end if
next
if errorlist="" then
cmdTemp.CommandText = "SELECT * FROM basket WHERE session_id = '" & session.SessionID & "' order by product_id"
Set recordSet = Server.CreateObject("ADODB.Recordset")
recordSet.Open cmdTemp, , adOpenKeyset, adLockOptimistic
if recordset.RecordCount = Request("quantity").count then
For i = 1 to recordSet.RecordCount
If recordSet.EOF then exit for
if trim(cstr(recordSet("Quantity"))) <> trim(cstr(formatnumber(Request("quantity")(i),0))) then
if not Isnull(recordSet("Product_type")) then
if trim(cstr(recordSet("Product_type")))<>"" then
oldproducttype=trim(cstr(recordSet("Product_type")))
oldquantity=csng(trim(cstr(recordSet("Quantity"))))
newquantity=formatnumber(Request("quantity")(i),0)-oldquantity
recordSet("Product_type").Value = trim(cstr(oldproducttype)) + ";-- *" + cstr(Csng(newquantity))
end if
end if
end if
recordSet("quantity").value = formatnumber(Request("quantity")(i),0)
recordset.Update
recordset.MoveNext
next
else
end if
end if
if errorList <> "" then
%>
<!--#INCLUDE FILE="include/error.asp" -->
<%
else
Response.Redirect "basket.asp"
end if
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?