asp语句循环问题,急!在线等!
<%'详细栏目内容sql3="SELECTTOP5F_ID,F_AnnounceID,F_BoardID,F_Username,F_Filename,F_Readme,F...
<%
' 详细栏目内容
sql3="SELECT TOP 5 F_ID,F_AnnounceID,F_BoardID,F_Username,F_Filename,F_Readme,F_Type,F_FileType,F_AddTime,F_Viewname,F_ViewNum,F_DownNum,F_FileSize,F_OldName FROM [DV_Upfile] WHERE F_Flag<>4 AND F_Type = 1 AND F_FileType='jpg' and F_BoardID<>35 AND F_ID in (select max(F_ID) from DV_Upfile group by F_AnnounceID) ORDER BY F_ID DESC"
set rs3=Dvbbs.Execute(sql3)
If Not RS3.Eof then
SQL3=Rs3.GetRows(-1)
'循环提取数据
For i=0 To Ubound(SQL3,2)
BoardID2=trim(SQL3(2,i))
'测试sql3(2,i)输出
'response.Write""&sql3(2,i)&""
'测试输出
'response.write""&BoardID2&""
sql4="SELECT TOP 10 F_Readme FROM [DV_Upfile] where F_BoardID="&BoardID2&" ORDER BY F_ID DESC"
set rs4=Dvbbs.Execute(sql4)
If Not RS4.Eof then
SQL4=Rs4.GetRows(-1)
'循环提取数据
ii=0
do while not((rs4.eof)and ii<=10)
if len(Stringhtml(SQL4(0,i)))>12 then
text2=left(Stringhtml(SQL4(0,i)),12)&"..."
else
text2=Stringhtml(SQL4(0,i))
end if
tex2t=replace(text2,"'","‘")
text2=replace(text2,"""","“")
' texts=texts&"|"&text
text2s=text2
'测试text2s输出
if text2s<>"" then
response.write""&text2s&""
else
response.write"没有数据!"
end if
dim w
if ii=0 then
w ="①"
end if
if ii=1 then
w="②"
end if
if ii=2 then
w="③"
end if
if ii=3 then
w="④"
end if
if ii=4 then
w="⑤"
end if
if ii=5 then
w="⑥"
end if
if ii=6 then
w="⑦"
end if
if ii=7 then
w="⑧"
end if
if ii=8 then
w="⑨"
end if
if ii=9 then
w="⑩"
else
w=""
end if
if ii=0 then
response.Write"&VRList="&ii&"=5"
response.Write"<br>"
response.Write"|#|"&w&""&text2s&""
else
response.Write"|@|10|#|"&w&""&text2s&""
response.Write"<br>"
end if
' if ii=10 then exit do
ii=ii+1
' if ii>=9 then exit do
rs4.movenext
loop
else
response.write "无下级板块"
end if
rs4.close:set rs=nothing
next
else
response.write "无下级板块"
end if
rs3.close:set rs=nothing
%>
'是我测试的,呵呵,谢谢,问题就是内循环不对。
外循环是取得需要的板块id。 内的小循环是取得该板块的多条记录,支取标题;改了好多次就是什么也不显示,测试能够取得板块id,但就是内循环不对,希望各位高手帮忙改一下,谢谢! 展开
' 详细栏目内容
sql3="SELECT TOP 5 F_ID,F_AnnounceID,F_BoardID,F_Username,F_Filename,F_Readme,F_Type,F_FileType,F_AddTime,F_Viewname,F_ViewNum,F_DownNum,F_FileSize,F_OldName FROM [DV_Upfile] WHERE F_Flag<>4 AND F_Type = 1 AND F_FileType='jpg' and F_BoardID<>35 AND F_ID in (select max(F_ID) from DV_Upfile group by F_AnnounceID) ORDER BY F_ID DESC"
set rs3=Dvbbs.Execute(sql3)
If Not RS3.Eof then
SQL3=Rs3.GetRows(-1)
'循环提取数据
For i=0 To Ubound(SQL3,2)
BoardID2=trim(SQL3(2,i))
'测试sql3(2,i)输出
'response.Write""&sql3(2,i)&""
'测试输出
'response.write""&BoardID2&""
sql4="SELECT TOP 10 F_Readme FROM [DV_Upfile] where F_BoardID="&BoardID2&" ORDER BY F_ID DESC"
set rs4=Dvbbs.Execute(sql4)
If Not RS4.Eof then
SQL4=Rs4.GetRows(-1)
'循环提取数据
ii=0
do while not((rs4.eof)and ii<=10)
if len(Stringhtml(SQL4(0,i)))>12 then
text2=left(Stringhtml(SQL4(0,i)),12)&"..."
else
text2=Stringhtml(SQL4(0,i))
end if
tex2t=replace(text2,"'","‘")
text2=replace(text2,"""","“")
' texts=texts&"|"&text
text2s=text2
'测试text2s输出
if text2s<>"" then
response.write""&text2s&""
else
response.write"没有数据!"
end if
dim w
if ii=0 then
w ="①"
end if
if ii=1 then
w="②"
end if
if ii=2 then
w="③"
end if
if ii=3 then
w="④"
end if
if ii=4 then
w="⑤"
end if
if ii=5 then
w="⑥"
end if
if ii=6 then
w="⑦"
end if
if ii=7 then
w="⑧"
end if
if ii=8 then
w="⑨"
end if
if ii=9 then
w="⑩"
else
w=""
end if
if ii=0 then
response.Write"&VRList="&ii&"=5"
response.Write"<br>"
response.Write"|#|"&w&""&text2s&""
else
response.Write"|@|10|#|"&w&""&text2s&""
response.Write"<br>"
end if
' if ii=10 then exit do
ii=ii+1
' if ii>=9 then exit do
rs4.movenext
loop
else
response.write "无下级板块"
end if
rs4.close:set rs=nothing
next
else
response.write "无下级板块"
end if
rs3.close:set rs=nothing
%>
'是我测试的,呵呵,谢谢,问题就是内循环不对。
外循环是取得需要的板块id。 内的小循环是取得该板块的多条记录,支取标题;改了好多次就是什么也不显示,测试能够取得板块id,但就是内循环不对,希望各位高手帮忙改一下,谢谢! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询