问题描述
- 数据集 eof和bof的问题
-
rsa=server.createobject("adodb.recordset")
if rsa.eof then
cc=1 //cc是一个变量
else
rsa.MoveLast
end if这句话什么意思,我如果从数据库中得到的数据在rsa中,rsa.eof到底什么意思啊。是不是有数据就定义cc=1 反之movelast
解决方案
rsa=server.createobject("adodb.recordset")
if rsa.eof then
表示没有数据记录
else
rsa.MoveLast
end if
not rsa.eof表示有记录
解决方案二:
探秘BOF 和EOF
解决方案三:
我今天碰到一个问题,就是if rsa.eof then 这句中无论我怎么变换条件 都显示true
cc=0
sql1="select * from gongjian2 where bh = '"&bh&"' and bhc = '"&bhc&"' and bhss between 800 and 999"
sql2="select * from gongjian2 where bh = '"&bh&"' and bhc = '"&bhc&"' and bhss between 8000 and 9999"
set rsa=server.createobject("adodb.recordset")
set rsa1=server.createobject("adodb.recordset")
set rsa2=server.createobject("adodb.recordset")
sql1=sql1&"order by bhss desc "
sql2=sql2&"order by bhss desc "
rsa1.Open sql1,conn,1,1
rsa2.Open sql2,conn,1,1
if rsa2.recordcount>0 then
rsa=rsa2
else
rsa=rsa1
end if
if rsa.eof then//就这里的条件我改成rsa.eof and rsa.bof也跳转到cc=1(sql1查出来有数据的,sql2也有数据的)
cc=1
else
rsa.MoveLast
end if