Search code examples
sqlasp.netvbscriptasp-classicrecordset

Repeat loop after EOF


It is posible to repeat loop again throught recordset after first loop?

<%
Response.Writ5 "First Loop"
do while not rs.EOF 
     Response.Write "<option>" & rs.Fields(0) & "</option>" & vbCrLf
   rs.MoveNext 
loop

'repeat
Response.Write "Second Loop"
do while not rs.EOF 
     Response.Write "<option>" & rs.Fields(0) & "</option>" & vbCrLf
   rs.MoveNext 
loop

%>

Solution

  • Quick answer: No.

    Record sets are forward only collections, there is no "SeekToStart" operation.

    if you need to pass over the data twice copy it into a local array, if the quantity of data is too much for that, then you probably need to rethink your approach.