asp 初学者 if语句不执行

exec="select bl,ed from yonghu where users = '"&ur&"'"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
set zj=conn.Execute("select sum(je) as num from xinxi where users='"&ur&"'") 
set bgje=conn.execute("select sum(je) as num from xinxi where users='"&ur&"' and yt like '办公%'")
response.Write(not (bgje.bof and bgje.eof))
response.Write(bgje("num"))
if not(bgje.bof and bgje.eof) then
rs("bl")=0
rs("ed")=zj("num")/2
else
rs("bl")=bgje("num")/zj("num")*100
rs("ed")=zj("num")/2-bgje("num")
end if
rs.update
rs.close

其中not(bgje.bof and bgje.eof)输出的值始终是ture没有false的时候,这是怎么回事?

sum,count这种sql语句总会有记录返回的,不需要判断游标是否在开始或者结束位置,你要判断rs这个游标,要不没有记录就会出错了

 exec="select bl,ed from yonghu where users = '"&ur&"'"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
set zj=conn.Execute("select sum(je) as num from xinxi where users='"&ur&"'") 
set bgje=conn.execute("select sum(je) as num from xinxi where users='"&ur&"' and yt like '办公%'")
if rs.eof then'''''''''''''
  if not(bgje.bof or bgje.eof) then
    rs("bl")=0
    rs("ed")=zj("num")/2
  else
    rs("bl")=bgje("num")/zj("num")*100
    rs("ed")=zj("num")/2-bgje("num")
  end if
  rs.update
else
  response.Write "记录不存在"
end if
rs.close

只需要其中一个为ture
not(bgje.bof or bgje.eof)