This is a discussion on "Counting RecordSets...." within the Classic ASP section. This forum, and the thread "Counting RecordSets.... are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Counting RecordSets....
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Counting RecordSets....
How do I go about doing this? Rob told me to do that but I couldn't figure it out. Is it objRS.Count or what? Also, been searching google and all I could really find on it is stuff about how the count messes up unless you count backwards... but not really any code for it. Any help would be much appreciated.
I'm trying to count objRS("ID") so that I can see on my details.asp page if the page exists or not. If the number is greater than the count then I give an "I'm sorry, this page does not exist". THanks. |
|
|
|
||||
|
are you referring to the recordcount property of the recordset object?
A simple objRS.RecordCount will return the number of records you have pulled with your SQL Select statement. If this returns zero, then you have no records. If it is not zero, then it holds a number equal to the number of records in the recordset (as the name suggests) Was this what you meant?
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
Ok, I'm having this problem. When I do as you stated above I get -1 . How can there be a -1 ? Any help/suggestions would be much appreciated.
|
|
||||
|
Hi Court Jester....
You have to be using a cursor that will support this. adOpenStatic and adLockOptimistic are both cursor's that will return a recordcount. The cursor is specified when you call 'open'. Does this make sense? If not, then please post your code.
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
Here's my code... everytime I put a cursor type in I get an error... This is the base coding, how would I set the cursor types? (sorry, I'm not used to this style of coding.
|
|
||||
|
use this as your code to open the recordset:-
Better still, place this in a file called global.asa in your root dir:-
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
![]() |
| Tags |
| counting, recordsets |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [need help-SEO]Counting no. of backlinks | RohanShenoy | Search Engine Optimization (SEO) | 6 | Feb 25th, 2008 06:51 |
| Counting Instances in a table. | Pheonix | Databases | 6 | Mar 18th, 2006 22:16 |
| PHP XML Counting Elements | Don Logan | PHP Forum | 1 | Mar 18th, 2006 03:03 |