Results 1 to 2 of 2

Thread: Recordcount property with ADO Keysets

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Isle of Man
    Posts
    276
    Do Keyset type cursors in ADO not support .Recordcount, or what??????

    if I run a simple query like this:

    SELECT * FROM ClientProfile;

    as a keyset, i get a recordcount of -1. All the records are in there and I can navigate thru it, eof/bof seem to work but i can't get the count, which is what i need

    if i open it as a Forward Only, or a Dynamic, i get a recordcount of 26.

    is there a way around this???


  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    When you request the RecordCount for a serverside recordset, a -1 may return. This occurs with ActiveX Data Objects (ADO) version 2.0 when the CursorType is adOpenForwardonly or adOpenDynamic. This occurs with ADO 1.5 only when the cursortype is adOpenForwardonly

    You don't say whether or not you're using an MS driver/database. MS drivers are infamous for not working with non-MS databases. Officially, MS blames the non-MS provider for this error.

    Also, not all combinations of LockType and CursorType work together. Changing a LockType sometimes forces a change in the CursorType; and this then creates the conditions for the -1 recordcount return. Most frustrating; but the bottom line is: forward only cursors will not return a reliable RecordCount.

    You have to either use adOpenKeyset or adOpenStatic as the CursorType for server side cursors or use a client side cursor. Client side cursors use only adOpenStatic for CursorTypes regardless of which CursorType you select.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width