Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 8th, 2005, 06:25 AM
Authorized User
 
Join Date: Apr 2004
Location: , , .
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!

Reply With Quote
  #2 (permalink)  
Old February 8th, 2005, 06:39 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
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
Reply With Quote
  #3 (permalink)  
Old February 8th, 2005, 07:13 AM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Madhu! It works =)

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04:03 AM
format total number..not working rissay Access 5 February 23rd, 2004 08:10 AM
Having problems returning total rows to asp Trojan_uk SQL Server 2000 1 December 9th, 2003 11:59 AM



All times are GMT -4. The time now is 09:29 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.