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

Brian Cummiskey Brian at hondaswap.com
Mon May 2 12:50:38 CDT 2005


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>



More information about the thelist mailing list