Click to See Complete Forum and Search --> : For Each loop with recordset


bloke
12-09-2003, 09:38 AM
Folks

Just mulling over some ideas here. Can I use For Each to group items in a recordset? If so, how?

ie I have a recordset which is grouped by a field. I want to write the records to the page thus:


for each fieldname in recordset
response.write fieldname1
response.write fieldname2
Next


if that makes any sense at all!

Cheers

Nicodemas
12-11-2003, 04:18 AM
Assuming "rs" is the name of your recordset:

<%

For Each x in rs.Fields
Response.Write x.Name & "<br />"
Next

%>

this should work!

bloke
12-12-2003, 04:21 AM
Thanks Rob

Did it a different way in the end but thanks for the tip. Should come in handy.

Cheers


Peter