如何判断recordset是否打开??

解决方案 »

  1.   

    用一个on error语名判断recorder对象打开是否有错,有错误就会到 on error定义的出错处理去,无错再就recordcount判断是否有记录
      

  2.   

    if isnull(recordset) then
        msgbox "recordset is open"
    else
        msgbox "recordset is nothing"
    end if
      

  3.   

    if rs.state=adstateopen then
      

  4.   

    楼上的楼上,你的代码错了,应该是这样的注:rs1为ADODB.Recordset对象If IsNull(rs1) Then
        MsgBox "recordset is nothing"
    Else
        MsgBox "recordset is open"
        rs1.Close
    End If
      

  5.   

    rs.state=adstateopen 表示 记录集 被 打开~~~可以进行对 rs.state=adstateopen 的判断结分~
      

  6.   

    我支持这个if rs.state=adstateopen then
      

  7.   

    假设你的记录集其它属性设置完毕
    State属性为测试记录集的状态
    private rs as new adodb.recordset
    if rs.state=adstateopen then            '如果记录集的状态是打开的
    rs.close                                '那么关闭它
    end if
    如果答对了,请别忘记了给分啊。谢了
      

  8.   

    if rs is nothing then exit sub
    if rs.state=0 then set rs=nothing:exit sub