我联接成功后如果不加m_pRecordset->CursorLocation=adUseClient
则SQL语名执行后m_pRecordset->RecordCount都返回-1,如果加了,则都返回0,而实际上是有数据不为0的.(而且我试过把游标设为adOpenStatic或adOpenDynamic,但结果还是和上面说的一样,不受影响)请问这是为什么?

解决方案 »

  1.   

    This property allows you to choose between various cursor libraries accessible to the provider. Usually, you can choose between using a client-side cursor library or one that is located on the server.This property setting affects connections established only after the property has been set. Changing the CursorLocation property has no effect on existing connections.Cursors returned by the Execute method inherit this setting. Recordset objects will automatically inherit this setting from their associated connections.This property is read/write on a Connection or a closed Recordset, and read-only on an open Recordset.
    //copy from msdn.
      

  2.   

    我一般是自已写个RecordCount函数,从头到尾算一遍,或者
    select count(*) from table