if rs.eof=True then 没有记录 else 有记录 endif要不,直接用on error resume next
If Not rs.eof And Not rs.bof Then 有记录 Else 没有记录 End If
if not (rs.eof and rs.bof) then '有记录 end if 这里说到一个有意思的问题 rs.open "select max(id) from table1" ,cn,adOpenForwardOnly,adLockReadOnly 这时候如果记录为空时,返回的rs.eof 和rs.bof都为false 此时要通过 rs.field(0) is null来判断是否有记录
if not rs.eof then 找到记录 else 没有找到记录 endif
就用 rs.RecordCount = 0 判断嘛if rs.RecordCount = 0 then flag = -1 end if然后根据flag再做处理
If Not recordset.eof And Not recordset.bof Then 有记录 Else 没有记录 End If
对结果集进行操作之前,检查一下recordset.recordcount属性。或用on error语句进行错误处理。
找到记录
else
没有找到记录
endif
没有记录
else
有记录
endif要不,直接用on error resume next
有记录
Else
没有记录
End If
'有记录
end if
这里说到一个有意思的问题
rs.open "select max(id) from table1" ,cn,adOpenForwardOnly,adLockReadOnly
这时候如果记录为空时,返回的rs.eof 和rs.bof都为false
此时要通过 rs.field(0) is null来判断是否有记录
找到记录
else
没有找到记录
endif
flag = -1
end if然后根据flag再做处理
有记录
Else
没有记录
End If