Re: ASP Loop question

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Matt Smith (crap_at_spam.com)
Date: 02/03/04


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%">&nbsp;</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



Relevant Pages

  • rotate revisited
    ... Suppose we have an array A containing n equi-spaced elements. ... The cost of this method (excluding loop costs) is: ... Each cycle is of length n/d. ... I will use the term "small slide" for a data move that is less ...
    (comp.programming)
  • Re: picking a new random seed
    ... avoid reusing the same random number sequence, I wrote a loop to run ... The real-time cycle counter on modern X86 processors provide a ... should change often (every machine cycle!) enough to keep Charles ... one of the more modern RNG algorithms if cycle size, ...
    (comp.lang.apl)
  • Re: Finding longest path in graph between two vertices
    ... is a cycle? ... path might be running through the loop (same vertices multiple ... I disagree with your definition. ... standard graph-theory terminology says that an arbitrary sequence ...
    (sci.math)
  • Re: PIC + DDS = Frequency Synthesizer?
    ... thus the software calculation loop cycle time ... are 20 instructions available to update the phase accumulator, ... lookup and control the DAC. ... software loop cycle. ...
    (comp.arch.embedded)
  • Re: How to choose FPGA for a huge computation?
    ... Depending on the accuracy and bit size. ... in one clock cycle. ... the loop above is only one of a half dozen intermediate ... orders require different "relatively random" accesses to the memory ...
    (comp.arch.fpga)