日期:2014-05-17  浏览次数:21028 次

这段代码为什么不好使那?
<%   set   rs=server.createobject( "adodb.recordset ")
sql= "SELECT   SUM(zongji)-SUM(xiaofei)   AS   h   FROM   zijin   where   name= ' "&Session( "UserId ")& " ' "
rs.open   sql,conn,3,2
dim   a
a=rs( "h ")
if   a <100   then
response.write " <script> alert( '余额不足! ');location.href   =   'login.asp '; </Script> "
response.end
end   if
rs.close
set   rs=nothing%>

就是想判断当A小于100时,弹出提示.

但是   我写的不对   高手看看我写错哪啦!

问题多,分给的少点,别介意啊,解决了立刻结帖!


------解决方案--------------------
sql= "SELECT SUM(zongji)AS g, SUM(xiaofei) AS h FROM zijin where name= ' "&Session( "UserId ")& " ' "
a=rs( "g ")-rs( "h ")

------解决方案--------------------
sql= "SELECT (SUM(zongji)-SUM(xiaofei)) AS h FROM zijin where name= ' "&Session( "UserId ")& " ' "
------解决方案--------------------
不知道你提示什么错误

上面写了2个可能

你在看下 if cint(a) < 100 then
------解决方案--------------------
定义字段的时候默认值设为0