Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2005, 07:25 AM
Authorized User
 
Join Date: Apr 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default total number of rows in a recordset

Hi! Is there a way where I can retrieve the total number of rows in a recordset without looping through each record? Is there a recordset property for this or something?

Thanks!

 
Old February 8th, 2005, 07:39 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Sure you can. But you have to set the cursor type of the recordset as adOpenStatic. Then rst.RecordCount will give the number of records.

Sample :

Dim qry
qry="SELECT <Field list> FROM <from clause> WHERE <condition clause>"
Dim rst
SET rst=Server.CreateObject("ADODB.RecordSet")
rst.CursorType=adOpenStatic
rst.Open qry, cnn ' cnn is the connection object
Response.Write rst.RecordCount
......
......

HTH,
Madhu
 
Old February 8th, 2005, 08:13 AM
Authorized User
 
Join Date: Apr 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Madhu! It works =)






Similar Threads
Thread Thread Starter Forum Replies Last Post
adding up a whole colum to give a total number KeviJay VB Databases Basics 2 May 29th, 2008 08:15 AM
adding all the rows to get a total value KeviJay SQL Language 2 May 29th, 2008 03:22 AM
count the TOTAL number of segments crmpicco Classic ASP Basics 2 February 1st, 2005 05:03 AM
format total number..not working rissay Access 5 February 23rd, 2004 09:10 AM
Having problems returning total rows to asp Trojan_uk SQL Server 2000 1 December 9th, 2003 12:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.