Re: ASP Loop question
From: Matt Smith (crap_at_spam.com)
Date: 02/03/04
- Next message: McKirahan: "Re: IIS 5.1 vs IIS 5.0?"
- Previous message: Bullschmidt: "Re: Database and asp question"
- In reply to: Darren: "ASP Loop question"
- Next in thread: Darren: "Re: ASP Loop question"
- Reply: Darren: "Re: ASP Loop question"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 3 Feb 2004 14:04:21 +0000 (UTC)
"Darren" <darrenstahlhut@hotmail.com> wrote in message
news:898d00a0.0402022056.3429fc6d@posting.google.com...
> Hi Everyone,
>
> I'm trying to work out how I can include something in a loop for all
> but the final pass. What I'm trying to do exactly is include an image
> (spacer.gif) in a table row to seperate the records, but I do not want
> the image to be included at the bottom of the page. I was thinking
> about using some sort of counter in my loop to determine if it is eof
> then... but I'm not that good at this ASP stuff yet. Ideas??
>
> Here's what I have so far
>
> <table>
>
> <% Do until rs.eof %>
> <tr>
> <td width="20%"><img src="images/<% Response.Write(rs("ProjectName"))
> %>.gif" border=1></td>
> <td width="75%"><% Response.Write(rs("ProjectName")) %><br><%
> Response.Write(rs("ProjectDescription")) %></td>
> <td width="5%"> </td>
> </tr>
>
> <tr>
> <td colspan=3 width="100%" align="center" valign="top"><img
> src="images/spacer3.gif" width="600" height="1"></td>
> </tr>
>
> <%
> rs.movenext
> loop
> %>
>
> Thanks in advance :)
>
> Darren Stahlhut
Hi Darren,
A word of advice: Quit using rs.eof. Use arrayvar = rs.GetRows()
There are lots of discussions on how to do this. Do a Google, or DevDex
search.
Basically array(column number, row number).
Then loop until UBound(arrayvar)
The loop is v. simple:
<TABLE>
Dim a_Rows, i_Row, i_NumRows
If Not rs.EOF Then
a_Rows = rs.GetRows
i_NumRows = UBound(a_Rows, 2)
End If
For i_Row = 0 To i_NumRows
THINGS HERE WILL APPEAR IN EVERY CYCLE
If i_Row <> i_NumRows Then
THINGS IN HERE WON'T APPEAR IN THE FINAL CYCLE
End If
Next
</TABLE>
Apologies for any errors.
HTH
Matt Smith
- Next message: McKirahan: "Re: IIS 5.1 vs IIS 5.0?"
- Previous message: Bullschmidt: "Re: Database and asp question"
- In reply to: Darren: "ASP Loop question"
- Next in thread: Darren: "Re: ASP Loop question"
- Reply: Darren: "Re: ASP Loop question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|