This is a multipart message in MIME format.
--=_alternative 0064CE658025711B_=
Content-Type: text/plain; charset="us-ascii"
I'm trying to loop through a text file that contains losts of surnames and
produce a table with all the A surnames in row 1, B surnames in row 2 etc
but I'm getting a bit stuck, I keep ending up with a table with 24 rows
and only the surnames begining with A in all the rows. I realise I need
to add another loop in somewhere to produce the table row and then move
onto the next letter but i can't get my head round it at the moment.
Here's my code:
<table border="1" width="520" align="center">
<%
for i = 65 to 89
do while objTextFile.AtEndOfStream <> True
strTextFileLine = objTextFile.ReadLine
if Left(strTextFileLine, 1) = i then
strSurnameList = strSurnameList &
strTextFileLine & ","
end if
Loop
strMain2 = "<tr><td>" & strSurnameList & "</td></tr>"
response.write strMain2
next
%>
</table>
--=_alternative 0064CE658025711B_=
Content-Type: text/html; charset="us-ascii"
<br><font size=2 face="sans-serif">I'm trying to loop through a text file that contains losts of surnames and produce a table with all the A surnames in row 1, B surnames in row 2 etc but I'm getting a bit stuck, I keep ending up with a table with 24 rows and only the surnames begining with A in all the rows. I realise I need to add another loop in somewhere to produce the table row and then move onto the next letter but i can't get my head round it at the moment.</font>
<br>
<br><font size=2 face="sans-serif">Here's my code:</font>
<br>
<br><font size=2 face="sans-serif"><table border="1" width="520" align="center"></font>
<br><font size=2 face="sans-serif"> <%</font>
<br><font size=2 face="sans-serif"> for i = 65 to 89</font>
<br><font size=2 face="sans-serif"> do while objTextFile.AtEndOfStream <> True</font>
<br><font size=2 face="sans-serif"> strTextFileLine = objTextFile.ReadLine</font>
<br><font size=2 face="sans-serif"> if Left(strTextFileLine, 1) = i then</font>
<br><font size=2 face="sans-serif"> strSurnameList = strSurnameList & strTextFileLine & ","</font>
<br><font size=2 face="sans-serif"> end if</font>
<br><font size=2 face="sans-serif"> Loop</font>
<br><font size=2 face="sans-serif"> strMain2 = "<tr><td>" & strSurnameList & "</td></tr>"</font>
<br><font size=2 face="sans-serif"> response.write strMain2</font>
<br><font size=2 face="sans-serif"> next</font>
<br><font size=2 face="sans-serif"> %></font>
<br><font size=2 face="sans-serif"> </table></font>
--=_alternative 0064CE658025711B_=--