asp中For Next循环嵌套 Do while循环,for next循环不起作用,求高手解答!
Setrscla=server.CreateObject("adodb.recordset")sqlcla="select*from[pclass]orderbyidas...
Set rscla=server.CreateObject("adodb.recordset")
sqlcla="select * from [pclass] order by id asc"
rscla.open sqlcla,conn,1,1
For k=1 To rscla.recordcount
Do while Not prors.eof
。。。。。。(省略,此循环正常)
Loop
rscla.movenext
Next
response.write(k)
rscla.close
Set rscla=Nothing
For next循环只能显示1个,rscla.recordcount 记录数为2,k计数显示3,不知道哪里出的问题?
'首页商品
Set rscla=server.CreateObject("adodb.recordset")
sqlcla="select * from [pclass] order by id desc"
rscla.open sqlcla,conn,1,1
’j=rscla.recordcount
For k=1 To rscla.recordcount
If rscla.eof Then Exit for
classname=rscla("pname")
classid=rscla("id")
'循环显示分类
prolist="<div class='pbanner'><h2>"&classname&"</h2></div><div class='prlist'>"& vbcrlf
Set prors=server.CreateObject("adodb.recordset")
sqlpro="select * from product where rmp=1 and classid="&classid&" order by xiao desc"
prors.open sqlpro,conn,1,1
'prolist="lanmu"
dim pm,topclass
pm=0
Do while Not prors.eof
。。。这里省略,放不下了!
prors.movenext
Loop
prors.close
Set prors=Nothing
prolist=prolist&"<div style='clear:both'></div>"& vbcrlf
prolist=prolist&"</div><!--prlist end -->"& vbcrlf
rscla.movenext
Next
‘prolist=prolist&k&j
rscla.close
Set rscla=Nothing 展开
sqlcla="select * from [pclass] order by id asc"
rscla.open sqlcla,conn,1,1
For k=1 To rscla.recordcount
Do while Not prors.eof
。。。。。。(省略,此循环正常)
Loop
rscla.movenext
Next
response.write(k)
rscla.close
Set rscla=Nothing
For next循环只能显示1个,rscla.recordcount 记录数为2,k计数显示3,不知道哪里出的问题?
'首页商品
Set rscla=server.CreateObject("adodb.recordset")
sqlcla="select * from [pclass] order by id desc"
rscla.open sqlcla,conn,1,1
’j=rscla.recordcount
For k=1 To rscla.recordcount
If rscla.eof Then Exit for
classname=rscla("pname")
classid=rscla("id")
'循环显示分类
prolist="<div class='pbanner'><h2>"&classname&"</h2></div><div class='prlist'>"& vbcrlf
Set prors=server.CreateObject("adodb.recordset")
sqlpro="select * from product where rmp=1 and classid="&classid&" order by xiao desc"
prors.open sqlpro,conn,1,1
'prolist="lanmu"
dim pm,topclass
pm=0
Do while Not prors.eof
。。。这里省略,放不下了!
prors.movenext
Loop
prors.close
Set prors=Nothing
prolist=prolist&"<div style='clear:both'></div>"& vbcrlf
prolist=prolist&"</div><!--prlist end -->"& vbcrlf
rscla.movenext
Next
‘prolist=prolist&k&j
rscla.close
Set rscla=Nothing 展开
2个回答
展开全部
prors.eof 应该是rscla.eof吧
追问
这个不重要,我找到问题了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询