或者说vb里如何处理这种异常???

解决方案 »

  1.   


        对结果集进行操作之前,检查一下recordset.recordcount属性。或用on error语句进行错误处理。
      

  2.   

    if not rs.eof then 
        找到记录
    else
        没有找到记录
    endif
      

  3.   

    if rs.eof=True then
       没有记录
    else
       有记录
    endif要不,直接用on error resume next
      

  4.   

    If Not rs.eof And Not rs.bof Then
      有记录
    Else
      没有记录
    End If
      

  5.   

    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来判断是否有记录
      

  6.   

    if not rs.eof then 
        找到记录
    else
        没有找到记录
    endif
      

  7.   

    就用  rs.RecordCount =  0 判断嘛if rs.RecordCount = 0 then
       flag = -1
    end if然后根据flag再做处理
      

  8.   

    If Not recordset.eof And Not recordset.bof Then
      有记录
    Else
      没有记录
    End If