[thelist] RePost - One for the GURU's asp loop

Brian Delaney brian.delaney at mccmh.net
Mon May 2 15:49:28 CDT 2005


Thanks, I changed  if y = 3 then  to if y = 4 and I get 3 columns




Brian Cummiskey wrote:

> Brian Delaney wrote:
>
>> Thanks for the response. The problem I have is that the output of 
>> this is:
>>
>> name  address  address1 city   state zip   name  address  address1 
>> city   state zip    name  address  address1 city   state zip
>>
>> instead of:
>>
>> name              name               name
>> address            address           address
>> address1        address1         address1
>> city state zip   city state zip     city state zip
>>
>
> oops, i read "row" as "column"
> :D
>
>
> i think this will do the trick...
>
> untested...
>
>
> <table>
>     <tr>
>
>
>         <%
>         dim y
>         y = 1
>
>         if not rst.EOF then
>
>             if y = 3 then
>                 ' start a new col.
>                 response.write "</tr><tr>"
>                 y = 1
>             end if
>
>
>             for x = 0 to rst.Fields.count - 1
>                 if x = 0 then           
>                     'name
>                     Response.Write "<td>" & trim(rst.Fields(x).Value) 
> &  "<br />" & vbcrlf
>                 elseif x = 1 then           
>                     'addr
>                     Response.Write trim(rst.Fields(x).Value) &  "<br 
> />" & vbcrlf
>                 elseif x = 2 then           
>                     'addr1
>                     Response.Write trim(rst.Fields(x).Value) &  "<br 
> />" & vbcrlf
>                 elseif x = 3 then           
>                     'C/S/Z
>                     Response.Write trim(rst.Fields(x).Value) & ", "
>                 elseif x = 4 then           
>                     'C/S/Z
>                     Response.Write trim(rst.Fields(x).Value) & " "
>                 elseif x = 5 then           
>                     'C/S/Z
>                     Response.Write & trim(rst.Fields(x).Value) vbcrlf 
> & "</td>" & vbcrlf
>                 else
>                     ' there is no else!!!
>                 end if
>             next
>
>             ' update new column trigger...
>                 y = y + 1
>            
>             rst.MoveNext
>            
>         loop   %>
>     
>     </tr>
> </table>
>

*
*
*
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.


More information about the thelist mailing list