Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputting Repeated Region 1

Status
Not open for further replies.

Mayoor

Programmer
Jan 16, 2004
198
GB
Hi I Need to output my recordset data in a specific way. I have 2 columns, Customer and Region. There are 6 regions I need to display first the region and then loop through and list the customers.

Region 1
- Customer
- Customer
- Customer

Region 2
-Customer
-Customer
-Customer
-Customer

Region 3
-Customer
-Customer
-Customer
-Customer

Can anyone point me to an effcient method for doing this in ASP Please?

 
Sort the data with sql and then use a loop to show it

Code:
sOldRegion = ""
while not rs.eof 

  if sOldRegion <> rs("region") then
     response.write "<br />Region " & rs("Region") & "<br />"
     sOldRegion = rs("region")
  end if
  
  response.write " - " &  rs("customer") & "<br />"

  rs.MoveNext
wend

Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
God well that was nice and easy!

thankyou very much,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top