Using RecordCount for Recordsets

Results 1 to 3 of 3

Thread: Using RecordCount for Recordsets

  1. #1
    Join Date
    Dec 1969

    Default Using RecordCount for Recordsets

    Hi,<BR><BR>I&#039;m using an Access database to store some customer data that will be used by a web application. I want to find out the number of records in an opened recordset. However I tried fiddling with the cursor loacation and cursor type propoerties but can&#039;t seem to get the RecordCount property to return correctly. It always returns -1.<BR><BR>Does anyone know how to handle this or is there any better way to count the number of records in a recordset?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default FAQS


  3. #3
    Join Date
    Dec 1969

    Default RE: Using RecordCount for Recordsets

    Because you open the recordset using a forward only recordset cursor by default, the record count is always -1 until you get to the end of the recordset.<BR><BR>I personally always use a separate SQL statement to count the records and have no problems with performance, i.e.:<BR><BR>&#060;%<BR>strSQL = "SELECT Count(RecordId) AS RecordCount FROM Tbl"<BR>&#039;...execute query<BR>Response.write rs("RecordCount")<BR>%&#062;

Posting Permissions

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