Copy link to clipboard
Copied
Has anybody any idea how to show/insert rownumbers in a dynamic table, supplied by SQL Server? Everything is working fine, but the finishing touch would be the row-numbers. This issue comes in handy when reading a large table.
Thanks in advance.
Robert alias slot20
Copy link to clipboard
Copied
don't know the answer, but it might be better to ask at
sorry forgot where I was, duh
Copy link to clipboard
Copied
slot20 wrote:
Has anybody any idea how to show/insert rownumbers in a dynamic table, supplied by SQL Server?
If you're using SQL Server, you're probably using ASP. I don't know the ASP syntax, but the basic principle is to use a variable as a counter, increment it with each iteration of the loop that displays the table, and display it.
In PHP, you would initialize the counter outside the table like this:
$i = 1;
And inside the table:
echo $i++;
Copy link to clipboard
Copied
David,
I think that your technic is the right one. Y're also right: I use Classic ASP, but I am no expert on that matter. So I cannot translate your suggestion in ASP, f.e. "echo" does not give any results. To give you any idea of the code in question see below:
<table border="1" cellpadding="0" cellspacing="1" class="tabel46">
<tr bgcolor="#FFCC00" class="tabel46">
<th>Coureur</th>
<th>Aantal Finishes</th>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT rsAantalFinishes.EOF)) %>
<tr>
<td nowrap="nowrap"><%=(rsAantalFinishes.Fields.Item("Coureur").Value)%></td>
<td><div align="center"><%=(rsAantalFinishes.Fields.Item("Aantal Finishes").Value)%></div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsAantalFinishes.MoveNext()
Wend
%>
</table>
I have to add a new field in combination with (perhaps) the index? Is there another forum (on ASP f.i.) where I could put this question?
I hope to hear from you once more.
Thanks,
Robert
Copy link to clipboard
Copied
Robert, your script already has a counter built in - Repeat1__index
Just use that in the first table cell:
<td><% = (Repeat1__index) %> </td>
At this point, I would strongly urge you to take a break from coding your website and spend a week learning the basics of ASP/VBScript. We all have to start somewhere, but learn-as-you-code will be extemeley frustrating and result in poor quality code. There a plenty of great classic asp sites with tutorials, but you may want to get one of the SAM's books on the subject. Good luck.
Copy link to clipboard
Copied
Bregent,
Y're completely right! I just ordered some ASP-books, but perhaps yoy have some bright titles/sites for me? Your solution is working perfectly, thanks for that.
Greetings,
Robert
Copy link to clipboard
Copied
I started with Sams Teach Yourself Active Server Pages in 24 Hours - you can really fly though it. But I think a better choice might be Sams Teach Yourself Active Server Pages 3.0 in 21 Days