iahamed via WebmasterKB.com wrote on 10 aug 2008 in
microsoft.public.inetserver.asp.general:
Indeantation corrected:
Quote:
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
Do UNTIL objRS.EOF
>
IF recCount Mod 3 = 0 THEN
>
IF recCount <0 THEN
Response.Write "</tr>"
Response.Write "<tr><td>"&objRS("Item")&"</td>"
ELSE
Response.Write "<td>"&objRS("Item")&"</td>"
END IF
END IF
Quote:
recCount = recCount + 1
objRS.MoveNext
Loop
>
Response.Write"</tr></table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
If you do not do your indenting correctly,
you easily miss an END IF,
so that a LOOP cannot find it.s DO
Even so your logic seems flawed,
as I think you will like to see all fields,
just 3 in a <tablerow.
Try:
======================================
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
DO UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
Response.Write "<tr>"
END IF
Response.Write "<td>"&objRS("Item")&"</td>"
recCount = recCount + 1
IF recCount Mod 3 = 0 THEN
Response.Write "</tr>"
END IF
objRS.MoveNext
LOOP
IF recCount Mod 3 <0 THEN
Response.Write"</tr>"
END IF
Response.Write"</table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
======================================
Or if you think as I do,
that </tdand </trwill be,
like <tbody></tbody>,
inserted anyway by most browsers:
======================================
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
DO UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
Response.Write "<tr>"
END IF
Response.Write "<td>" & objRS("Item")
recCount = recCount + 1
objRS.MoveNext
LOOP
Response.Write"</table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
======================================
not tested.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)