Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    114

    Unanswered: Recordcount Issue

    This is weird. I have (identical) copies of sql server running on two seperate machines. I have a vb app that accesses the data. It runs with both dbs but I have the following function that I call to show the record count in a particular display:

    Code:--------------------------------------------------------------------------------

    Dim rs As Recordset

    'determines number of records in a sql statement
    Set rs = New ADODB.Recordset
    rs.Open sql, conn, adOpenStatic, adLockOptimistic
    RecordCount = rs.RecordCount
    rs.Close
    Set rs = Nothing

    --------------------------------------------------------------------------------With one db it works just fine but with the other it returns a value of -1 even though the data is displayed just fine. Any ideas?

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    You need to make sure that you have a client side sursor for this to work.

    I always work with disconnected recorsets so it's not an issue.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I'm not a VB expert, but I think you need to use rs.movelast in order to get an accurate count.

    blindman

Posting Permissions

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