如何将记录按8*11的方格显示,这个循环不太好写
通过select查询后,如何利用循环将所得数据按一个类似于8*11的方格显示(一共86条记录)
这个循环不太好写
[解决办法]
i=1
do until rs.eof
response.write rs( "aaa ")
if i mod 8=0 then response.write " <br/> "
i=i+1
loop
[解决办法]
就是一共显示成8列是吧?
i = 1
do while not rs.eof
response.write(rs( "aaa "))
if i % 8 = 0 then
response.write( " <br /> ")
else
response.write( " ")
end if
i = i + 1
rs.movenext
loop
[解决办法]
call GetIndexTop( "Select Top 88 * From Table ") '8*11=88
sub GetIndexTop(SQL)
response.write " <table width= '100% ' border=0 align=center cellpadding=0 cellspacing=0> "
dim i,k
Set Rs=Server.CreateObject( "ADODB.Recordset ")
Rs.open sql,conn,1,1
if rs.eof then
response.write " <tr> <td conspan=8 align=center> 无记录 </td> </tr> "
else
i=0
do while not rs.eof
i=i+1
if i = 1 or ((i mod 8 = 1) and i > 8 ) Then Response.write " <tr align= 'center '> "&vbCrLf
response.write " <td align=center> "
response.write Rs(0)
response.write " </td> "
if i = 8 or (i mod 8 = 0) Then Response.write " </tr> "&vbCrLf
rs.movenext
loop
If (i mod 4) <> 0 Then
for k = 1 to (8 - (i mod 8))
Response.write " <td align=center> </td> "&vbCrLf
Next
Response.Write " </tr> "&vbCrLf
End If
end if
Rs.Close
Set Rs=Nothing
response.write " </table> "
end sub