...

View Full Version : numbering ASP results



rparish
04-12-2007, 11:28 PM
I would like my results to be numbered numerically from 0 till infinity

For Example if my database contained:

Bob Jones
Fred Jones
Billy Jones


It would display:

0 Bob Jones
1 Fred Jones
2 Billy Jones

I have my database on autonumber, but the numbers get messed up with we delete records.

westmatrix99
04-13-2007, 06:26 AM
There is a way to code it that the numbers do show the you want them.
I for the life of me can't find that damn code on my PC.
When I do will post it.

But yes that is possible to renumber it the way you want it.

Otherwise in the mean time, why not make another field called sort and sort by that field instead: start with 0 to how many you need.

Cheers

Baleric
04-17-2007, 05:10 AM
make an array,



<%
dim numbering
numbering = 0

do while not RS.eof

''''''''write the number and you DB value

response.write(numbering), response.write(RS("FieldName"))

''''''''increment the variable numnering by 1 and then loop it back to the beginning

numbering = numbering + 1


loop
%>


not sure if the loop will work but im sure you get the drift

degsy
04-18-2007, 01:52 PM
You don't have to do anything with arrays, just increment a counter



While Not rs.EOF
Response.Write Counter & ": " & rs("field") & "<br>"
Counter = Counter+1
rs.MoveNext
Wend

Baleric
04-19-2007, 04:04 AM
thats what i meant :P my bad



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum