xgsl.asp

来自「oracle9i程序事例集」· ASP 代码 · 共 53 行

ASP
53
字号
<!--#include file="../common/conn.asp"-->
<%
if session("user_name")="" and session("company_name")="" then
response.write "<script language=javascript>alert('对不起,您还没有登陆!');window.close();</script>"
response.End
end if

if session("user_name")<>"" then
  uname=session("user_name")
else
  uname=session("company_name")
end if

set rs=server.CreateObject("adodb.recordset")
set rs1=server.CreateObject("adodb.recordset")
sql="select * from scott.shopping_bag where sb_uname='"&uname&"' order by sb_proname"
rs.open sql,connstr,3,3

if rs.bof and rs.eof then
  response.write "<script language=javascript>alert('对不起,您没有选择商品!');window.close();</script>"
  response.End
end if

do while not rs.eof

sql="select product_id, product_stocknum from scott.product_info where product_num='"&rs("sb_proname")&"'"
rs1.open sql,connstr,1,1
stocknum=cint(rs1("product_stocknum"))

newnum=cint(request.Form(cstr(rs1("product_id"))))
rs1.close

if newnum<=0 then
newnum=1
end if

if stocknum < newnum then
response.write "<script language=javascript>alert('你选购的商品“"&rs("sb_proname")&"”库存不足,不能修改数量,请选购更换其它商品!');window.location.href='gouwu.asp?action=show&lx=1';</script>"
response.End()
else
rs("sb_amount")=newnum
rs("sb_total")=cint(rs("sb_price"))*newnum
rs.update
end if
rs.movenext
loop

response.Redirect "gouwu.asp?action=show&lx=1"
rs.close
set rs1=nothing
set rs=nothing
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?