displaying db results with asp

  • Thread starter Thread starter matt shudy
  • Start date Start date
M

matt shudy

Hi,

I am using a
Do While Not objRS.EOF loop,
after that has completed is it at the end of the file?...
meaning that you can't call that same loop again? I want
to make three different tables using the same db record,
so i just use an if statementin the while loop to pull out
the records that i want, but then the next table won't
populate. Is there a way to reset the loop so it starts
at the top of the file again? Please let me know if you
need this explaied different.

Thanks,

Matt Shudy
 
Hi Matt,

You can start over with oRs.movefirst. In general tho getrows is a much more
efficient way to loop thru a recordset. Eg -
<%
set oRs = server.createobject("adodb.recordset")
ors.open "select field from table", 'connection string
aData = oRs.getrows
oRs.close: set oRs=nothing
for i = 0 to ubound(aData,2)
response.write aData(0,i) & "<BR>"
next
' we can then start again by repeating the loop
for i = 0 to ubound(aData,2)
response.write aData(0,i) & "<BR>"
next
%>
 
Thank you, this helped a lot.

Matt
-----Original Message-----
Hi Matt,

You can start over with oRs.movefirst. In general tho getrows is a much more
efficient way to loop thru a recordset. Eg -
<%
set oRs = server.createobject("adodb.recordset")
ors.open "select field from table", 'connection string
aData = oRs.getrows
oRs.close: set oRs=nothing
for i = 0 to ubound(aData,2)
response.write aData(0,i) & "<BR>"
next
' we can then start again by repeating the loop
for i = 0 to ubound(aData,2)
response.write aData(0,i) & "<BR>"
next
%>

--
Jon
Microsoft MVP - FP




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Problem with access acImportDelim importing csv with headers 1
asp question 2
asp help 2
PowerPoint Randomise slides and have an infinite loop 0
instant messenger with asp 1
SQL help 1
ASP question 34
upadting db 1

Back
Top