我想实现出库的数量不能大于库存的数量?不知如何做。。,。请高手们解决,多谢。
<%
select case action
case "add"
sqlup="select * from [myjxc] WHERE gg='"&gg&"' and mc='"&mc&"'"
set rsup=server.createobject("adodb.recordset")
rsup.open sqlup,conn,2,3
if not rs.eof then
dt=trim(htmlencode(request.form("dt")))
zy=trim(htmlencode(request.form("zy")))
jxclx=trim(htmlencode(request.form("jxclx")))
mc=trim(htmlencode(request.form("mc")))
xh=trim(htmlencode(request.form("xh")))
gg=trim(htmlencode(request.form("gg")))
ys=trim(htmlencode(request.form("ys")))
sl=trim(htmlencode(request.form("sl")))
dw=trim(htmlencode(request.form("dw")))
dj=trim(htmlencode(request.form("dj")))
je=trim(htmlencode(request.form("je")))
jsr=trim(htmlencode(request.form("jsr")))
bz=trim(htmlencode(request.form("bz")))
ip=Request.ServerVariables("REMOTE_HOST")
kcsl=rsup("sl")
if "&kcsl&">="&sl&" then
conn.execute("INSERT INTO [cktable] (dt,zy,jxclx,mc,xh,gg,ys,sl,dw,dj,je,jsr,bz,ip) VALUES('"&dt&"','"&zy&"','"&jxclx&"','"&mc&"','"&xh&"','"&gg&"','"&ys&"','"&sl&"','"&dw&"','"&dj&"','"&je&"','"&jsr&"','"&bz&"','"&ip&"')")
conn.execute("UPDATE [myjxc] SET sl=sl-"&sl&" WHERE gg='"&gg&"' and mc='"&mc&"'" )
else
Response.Write "<script language=javascript>alert('出库数量大于库存数量!');javascript:history.go(-1);</script>"
response.end
end if
end if
rsup.close()
session.Contents.Remove("mc")
session.Contents.Remove("gg")
session.Contents.Remove("xh")
session.Contents.Remove("dw")
session.Contents.Remove("bz")
session.Contents.Remove("ys")
response.write"<div align=center><br><br><br><br>表单操作成功!</div>"
response.write"<meta http-equiv='refresh' content='2;URL=../.'>"
response.end
%>