怎样判断结果集是否为空rsQues.Open "select * from userResult where portablephone='" & phone & "'", conQues, 3, 3
   
   
   '如果该手机号码存在
   If rsQues.BOF <> rsQues.EOF Then       <--------此处老相等
    ....
   end if

解决方案 »

  1.   

    if not rsques.eof then   '如果有记录则
      

  2.   

    if not (rsQues.BOF and rsQues.EOF ) then
      

  3.   

    if rsQues.recordcount=0 then
        msgbox "无此记录!",48,"提示"
        exit sub
    else
        ...
    end if
      

  4.   

    有记录的时候,记录的指针当然不总是在开始和结尾了,不在开始和结尾他们两个都为False,就是总相等!可以根据EOF和RecordCount来循环判断
      

  5.   


    if not Rs.eof then
        '有记录做相应处理
       while not rs.eof
             '
             rs.movenext
       wend
    esle
        msgbox "无满足条件的记录!"
    end if