要设置打开数据集的参数,
recordset.Open Source, ActiveConnection, CursorType, LockType, Options
具体参见msdn

解决方案 »

  1.   

    我用的是ADO的。
    ado的是很简单的阿!
      

  2.   

    dim cntTest as connection
    dim rdsTest as Recordset
    set cntTest =new connection
    cntTest.Connectionstring=......
       .
       .
       .
    cntTest.CursorLocation = adUseClient
    set rdsTest=cntTest.Execute("......")
    rdsTest.Recordcount will greater than -1
      

  3.   

    if not rs.EOF then
        rs.movelast
        recCount=rs.AbsolutePosition + 1
    else
       recCount=0
    end if
      

  4.   

    adOpenKeyset 以键集方式或 adUseClient 客户端游标打开
      

  5.   

    你需要以客户端游标方式打开adUseClient
      

  6.   

    如果你用静态游标(adOpenStatic)就没有问题了,返回的是真实的记录数.
    用其它三种游标(adOpenForwardOnly,adOpenKeyset,adOpenDynamic),返回的不是真实的数.rs.recordcount=-1.
      

  7.   

    dim cn as new adodb.connection
    dim rs as new adodb.recordset...rs.CursorLocation = adUseClient
    只需要将rs的游标方式设置为adUseClient
      

  8.   

    在取rs.recordcount之前调用rs.movelast即可。