if ado.recordset.eof=false or ado.recordset.bof=false then
ado.recordset.movelast
debug ado.recordset.recodcount
end if

解决方案 »

  1.   

    rsRms.Open strSql, connRms, adOpenStatic, adLockReadOnly
    用静态方式打开adOpenStatic
      

  2.   

    动态的也可以
    假设connection为gcn,recordset变量为rs,sql语句为strsql(string型)

      sql="select * from table"
      set rs=gcn.execute(strsql)
    然后 你看一下rs.recordcount是多少,(如果查询结果为0条记录,才返回-1,否则是多少返回多少)
      

  3.   

    1.rsRms.Open strSql, connRms,adOpenKeyset,adLockOptimistic '键集方式打开即可2.将 Class 的 Instancing 属性设为: 6 - GlobalMultiUse 表示这个类的各种属性和方法可以象简单的全局函数那样被调用。该类的实例不需要显式创建,因为它会自动创建。 
      

  4.   

        程序开头加上
        recordset.MoveLast
        recordset.MoveFirst     
      

  5.   

    set rs=db.execute("select count(*) as records from Table")
    recordCount=rs.field("records")
    绝对正确!
      

  6.   

    试一试下面这段代码:
        Dim Con As New ADODB.Connection
        Dim Rs As New ADODB.Recordset
        
        Con.Open "conOffice", "uid", "pwd"
        Rs.LockType = adLockOptimistic
        Rs.CursorType = adOpenKeyset
        
        Rs.Open "eis_user.city", Con, adOpenKeyset
        MsgBox Rs.RecordCount
    不过,使用RecordCount时,如果表里的数据量太大,有可能会取回一个大致的数据,而不是精确的数据,即使打开记录后用到了MoveFirst以及MoveLast。我曾经遇到过。
      

  7.   

    设置cn.CursorLocation = adUseClient