CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 1999
    Location
    MLA, PHIL
    Posts
    11

    Recordcount Returns -1

    I am using ADO and wanted to get the number of records in a result set. I use SQL SERVER 7.0. But everytime I issuse the command RecordCount, it always return -1 eventhough there are records in the resultset. Are there any solution for this problem?

    Thanks


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Recordcount Returns -1

    here is the answer from MSDn:
    "Use either 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. "


  3. #3
    Guest

    Re: Recordcount Returns -1

    Had the same problem. You must set your recordset's CursorLocation - adUseClient (I dont' remember the exact constant but I think that's what it is). One problem - it has to read the entire recordset into memory to know how many records are there so if you recordset is really big you'll run out of memory.


  4. #4
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: Recordcount Returns -1

    had the same problem just a few weeks ago. I had two recordsets open (same name). I had forgotten to close one in another form.

    David Paulson

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

Featured