Print Page | Close Window

Access Database Records Found Count

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=15224
Printed Date: 30 March 2026 at 3:26am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Access Database Records Found Count
Posted By: KenW
Subject: Access Database Records Found Count
Date Posted: 25 May 2005 at 2:50pm
Hi
Can anyone tell me where I can find a script that tells you the number of records that have been found by a db search, or can the code below be adapted to count only the records found??

<%DIM mySQL, objRS
mySQL = "SELECT Count(*) AS intTotal FROM tblmembers"
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRS = conn.Execute(mySQL)
' Display result
Response.Write "Number of Members Currently in The Database is &nbsp;&nbsp;"
Response.Write objRS("intTotal")
objRS.Close
set objRS = Nothing
%>

 Thanks in advance for any help
Ken


-------------
Ken Home User enjoys ASP as a hobby



Replies:
Posted By: dj air
Date Posted: 25 May 2005 at 3:07pm
what happens when running the above query.

also try CInt(objRS("intTotal")) when writing the number


Posted By: Mart
Date Posted: 25 May 2005 at 4:06pm
Sure, just add ",count(*) as intTotal" to your select statement and it will only count rows that were filtered.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net