[thelist] One for the GURU's asp loop

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Fri Apr 29 10:51:59 CDT 2005


Hi Brian,

   I'm not sure about the guru status, but I'll take a shot.

   First off, I'd suggest using the GetRows() method of the recordset (  http://learnasp.com/learn/whygetrows.asp  ). It's a lot more efficient, and it gives you an array that you can walk through (back, forward, up, down) at your leisure.

   I don't know exactly how you're rendering these addresses, but I would think you'd want to do something like this:

For i=0 to UBound(arrRecords, 2)
   Select Case i Mod 3
      Case 0 ' Beginning of a new row
         myCSSClass = "beginRow"
      Case 1 ' Middle item in the row
         myCSSClass = "middleOfRow"
      Case 2 ' End of the row
         myCSSClass = "endRow"
   End Select

   WriteAddress(myCSSClass, companyName, addr1, addr2, city, state, zip)
Next

   Of course you could always do the Response.Write part right there instead of putting it in a separate subroutine...

HTH,

Peter

 From: Brian Delaney  brian.delaney at mccmh.net 

I have a recordset that contains company name,addr,addr1,city,state,zip

I am trying to format the asp output so labels can be printed. I am 
close using a style sheet and some margin tweaking.

My question is as follows:

I need to write the records 3 companies per row:

company1 company2 company3
addr addr addr
addr1 addr1 addr1
city,state zip city,state zip city,state zip

I originally used 3 arrays to read the first, second and third company 
with movenext in between, then write out the row using the arrays,
loop, redim my arrays and get the next three - repeat.

This produces duplicate companies.

Looking for suggestions on the best way to handle this. Maybe use the 
cursor command to get the first three?

I use ASP on MS with sql 2000 backside.

Thanks

*
*
*
This message, including any attachments, is intended solely for the use of the named recipient(s) and may contain confidential and/or priveleged information. Any unauthorized review, use, disclosure or distribution of this communication(s) is expressly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy any and all copies of the original message.
-- 

* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 




More information about the thelist mailing list