Author |
Topic  |
|
DaMegz
Junior Member
 
126 Posts |
Posted - 12 September 2007 : 22:33:16
|
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
|
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 |
 |
|
DaMegz
Junior Member
 
126 Posts |
Posted - 13 September 2007 : 14:46:54
|
Thanks shaggy, i will try it out |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 13 September 2007 : 15:43:54
|
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 |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 14 September 2007 : 04:58:54
|
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.” |
 |
|
DaMegz
Junior Member
 
126 Posts |
Posted - 23 September 2007 : 08:52:45
|
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 |
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 23 September 2007 : 10:35:28
|
quote: Originally posted by DaMegz
If I use Recordset.absoluteposition I get -1.
Sounds like it might not be a supported property... |
 |
|
DaMegz
Junior Member
 
126 Posts |
Posted - 23 September 2007 : 10:39:02
|
How would i know if its supported? |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 24 September 2007 : 15:26:41
|
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 |
 |
|
|
Topic  |
|