<%
dim i,j
dim iRsCount,iRows,strpicd
dim perLines
perLines=2 '每行需显示的列数
strpicd="select * from v_web_news where c_name='"&cname2&"' and npic is not null order by id desc"
set objRs=Server.CreateObject("ADODB.RecordSet")
objRs.open strpicd,conn,1,1
if not objRs.eof then
response.write "
"&vbcrlf
iRsCount=objRs.recordcount '取得实际的记录数
iRows=int(iRsCount/perLines) '计算可得到的行数
if iRows<1 then
iRows=1
else
if iRsCount mod perLines=0 then
iRows=int(iRsCount/perLines)
else
iRows=int(iRsCount/perLines)+1
end if
end if
i=1
while not objRs.eof
for i=1 to iRows
response.write ""&vbcrlf
for j=1 to perLines
If Not objRs.eof then
'response.write " | "&vbcrlf
response.write " | "&vbcrlf
Else
response.write " | "&vbcrlf
End if
if not objRs.eof then objRs.movenext
next
response.write "
"&vbcrlf
'---
response.write ""&vbcrlf
response.write " | "&vbcrlf
response.write " | "&vbcrlf
response.write "
"&vbcrlf
'---
next
Wend
response.write "
"
end if
objRs.close
set objRs=nothing
%>
阅读(1088) | 评论(0) | 转发(0) |