Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

loop
I'm trying to make a table with values I pulled from a recordset - for
example a table has rows a,b,c and cols 1,2,3.  Each row is formed by a
loop, but I don't necessarily have values for each cell- the row is
determined by one of the fields- (in the example "y" specifies the row)

how do I start the loop over in the middle of the loop?

specifcally:
dbrs.MoveFirst()
do while not dbrs.eof
dbrs. Move(0)
x = dbrs("x")
y = dbrs("y")

%>
<tr>
<% if x = "a1" then
response.write("<td>" & value1 & "</td>")
else
response.write("<td></td>")
end if
dbrs.MoveNext
y2 = dbrs("y")
if y2 = y1 then
'continue with code
else
response.write("<td colspan=2></td></tr>")
' ? goto beginning of loop
end if
%>
<td>
<% if x = "a2" then
response.write("<td>" & value2 & "</td>")
else
response.write("<td></td>")
end if
dbrs.MoveNext
y2 = dbrs("y")
if y2 = y1 then
'continue with code
else
response.write("<td></td></tr>")
' ? goto beginning of loop
end if
%>
<td>
<% if x = "a3" then
response.write("<td>" & value3 & "</td>")
else
response.write("<td></td>")
end if
%>
</tr>
<%
dbrs.MoveNext
loop
%>

Thanks, Amanda


*** Sent via Developersdex http://www.examnotes.net ***

Report this thread to moderator Post Follow-up to this message
Old Post
Amanda Hallock
05-31-05 01:55 AM


Re: loop
Place

dbrs.MoveFirst()

where you have

>     ' ? goto beginning of loop

The above will start the loop over. Now if what you want
is to just move on to the next loop item, then you need to
nest your IF statements in such a way so that no further
code within the loop will be excuted until the next time
around.

Good luck
Saga

"Amanda Hallock" <amanda2@southwind.org> wrote in message
news:Oa0cx8UZFHA.1404@TK2MSFTNGP09.phx.gbl...
> I'm trying to make a table with values I pulled from a recordset - for
> example a table has rows a,b,c and cols 1,2,3.  Each row is formed by
> a
> loop, but I don't necessarily have values for each cell- the row is
> determined by one of the fields- (in the example "y" specifies the
> row)
>
> how do I start the loop over in the middle of the loop?
>
> specifcally:
> dbrs.MoveFirst()
> do while not dbrs.eof
> dbrs. Move(0)
>    x = dbrs("x")
>    y = dbrs("y")
>
> %>
> <tr>
> <% if x = "a1" then
>      response.write("<td>" & value1 & "</td>")
>   else
>      response.write("<td></td>")
>   end if
>   dbrs.MoveNext
>   y2 = dbrs("y")
>   if y2 = y1 then
>     'continue with code
>   else
>     response.write("<td colspan=2></td></tr>")
>     ' ? goto beginning of loop
>   end if
> %>
> <td>
> <% if x = "a2" then
>      response.write("<td>" & value2 & "</td>")
>  else
>      response.write("<td></td>")
>   end if
>   dbrs.MoveNext
>   y2 = dbrs("y")
>   if y2 = y1 then
>     'continue with code
>   else
>     response.write("<td></td></tr>")
>     ' ? goto beginning of loop
>   end if
> %>
> <td>
> <% if x = "a3" then
>      response.write("<td>" & value3 & "</td>")
>  else
>      response.write("<td></td>")
>   end if
> %>
> </tr>
> <%
> dbrs.MoveNext
> loop
> %>
>
> Thanks, Amanda
>
>
> *** Sent via Developersdex http://www.examnotes.net ***



Report this thread to moderator Post Follow-up to this message
Old Post
Saga
05-31-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.