Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Show record number help
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

DaMegz
Junior Member

126 Posts

Posted - 12 September 2007 :  22:33:16  Show Profile
I run a football pool with a field holding the total number of wins (numeric) for each player. I can show the recordset in Desc order...thats not a problem. What I want to be able to do, is show what place they are in. For Example: Joe Shmoe your position is 3

This number would be the record number for that query, when in Desc order. So the 3rd record down would be in 3rd place, and the 10th record would be in 10th place.

I hope someone cam help!
Thanks

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 13 September 2007 :  04:44:28  Show Profile
As you loop the the records and write the out, add a new varaibale that will increment by one with each loop and then write it out as well. For example:
dim MyInt:MyInt=1
do until MyRecordset.eof
	response.write	MyInt&" Your stuff here"
	MyInt=MyInt+1:MyRecordset.movenext
loop

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”

Edited by - Shaggy on 14 September 2007 04:57:53
Go to Top of Page

DaMegz
Junior Member

126 Posts

Posted - 13 September 2007 :  14:46:54  Show Profile
Thanks shaggy,
i will try it out
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 13 September 2007 :  15:43:54  Show Profile
An alternative is to use the AbsolutePosition property of the recordset, assuming your recordset provides that property.

response.write rs.absoluteposition


======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 14 September 2007 :  04:58:54  Show Profile
You're welcome, 'Megz

And thanks for that property, Doug; never knew it existed.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

DaMegz
Junior Member

126 Posts

Posted - 23 September 2007 :  08:52:45  Show Profile
I have tried both solutions....but both had different errors.
Shaggy: Your solution almost worked. Maybe I didnt code it right (which is very, very possible), but I get the number 1 twice, then it counts properly. I have 86 players in the pool, so when i list them in order, the first 2 records show as #1, and the last one shows #85. Maybe Im close?

Doug: I liked your solution, but I may have a syntax error. After doing some research, it looks like the proper syntax is objRecordset.Absoluteposition. I get error saying " is expected. Where would that go?
If I use Recordset.absoluteposition I get -1.

Thanks for your help...I wish I knew what I was doing with this!!!

Edited by - DaMegz on 23 September 2007 08:56:45
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 23 September 2007 :  10:35:28  Show Profile  Visit AnonJr's Homepage
quote:
Originally posted by DaMegz

If I use Recordset.absoluteposition I get -1.


Sounds like it might not be a supported property...
Go to Top of Page

DaMegz
Junior Member

126 Posts

Posted - 23 September 2007 :  10:39:02  Show Profile
How would i know if its supported?
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 23 September 2007 :  18:05:16  Show Profile
Here's what the -1 means from absoluteposition

http://msdn2.microsoft.com/en-us/library/ms681440.aspx

Are you using an OLEDB provider?

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 24 September 2007 :  15:26:41  Show Profile  Send pdrg a Yahoo! Message
My hunch is that you've got an old MDAC or are using ODBC instead of OLEDB

As for the looped solution, you're probably incrementing the looped variable before the output - try moving the increment to right before you loop round
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07