Recordcount

Results 1 to 4 of 4

Thread: Recordcount

  1. #1
    Rupali Guest

    Default Recordcount

    How can I count the records in a recordset?As my .recordcount method fails to do so.

  2. #2
    Join Date
    Dec 1969
    Posts
    308

    Default RE: Recordcount

    Try this:<BR>&#060;!--#INCLUDE VIRTUAL="/ADOVBS.INC" --><BR>&#060;%<BR>set dbconn = Server.CreateObject("ADODB.Connection")<BR>set RS = Server.CreateObject("ADODB.RecordSet")<BR>sql = "SELECT * FROM tbl_WhatEver"<BR>rs.open sql, Application("YourDSN") , adopenstatic<BR>howmanyrecs=rs.recordcount<BR>&#03 7;&#062;<BR><BR>Some notes: You need to have the ADOVBS.inc file in there some place. You can get it from a number of places on the web. You also have to have a cursor that will support moving around a recordset. Adopenstatic works fine.<BR><BR>Hope that helps!<BR><BR>--brad

  3. #3
    Sam Otto Guest

    Default RE: Recordcount

    Yea, the problem is the type of recordset you are using. Another, alothough inefficient, option is to do a SELECT Count(*) as num FROM table WHERE... to get the count.

  4. #4
    Join Date
    Dec 1969
    Posts
    672

    Default RE: Recordcount

    if that doesn&#039t work, try thisrs.open sql, Application("YourDSN") , 3
    ________
    Spice weed
    Last edited by Jay; 04-16-2011 at 01:31 AM.


Posting Permissions

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