想要循环调用代码如下:
do while
tempcontent=tempcontent&" <tr>"
tempcontent=tempcontent&" <td height=20 valign=top> <img src=news/images/pot_"&s_pic&".gif align=absmiddle>"
tempcontent=tempcontent&" <a href='news/news/view.asp?id="&rsa("id")&"' target=_blank title='"&rsa("title")&"'>"&atempTitle&"</a>"&o_char&newimg&hot
tempcontent=tempcontent&" </td>"
tempcontent=tempcontent&" </tr>"
rsa.movenext
loop
请问do while循环应该怎么写啊?
do while
tempcontent=tempcontent&" <tr>"
tempcontent=tempcontent&" <td height=20 valign=top> <img src=news/images/pot_"&s_pic&".gif align=absmiddle>"
tempcontent=tempcontent&" <a href='news/news/view.asp?id="&rsa("id")&"' target=_blank title='"&rsa("title")&"'>"&atempTitle&"</a>"&o_char&newimg&hot
tempcontent=tempcontent&" </td>"
tempcontent=tempcontent&" </tr>"
rsa.movenext
loop
请问do while循环应该怎么写啊?
解决方案 »
- ashx运行后么反映的问题 帮帮下
- 怎样根据TextBox文本框的失去焦点事件设置文本框的Text为当前日期?
- 怎样同步数据库?
- 用动软生成架构,遇到这么个莫名奇妙的问题,求解答!!
- ASP.NET随机生成验证码 加断点与不加的结果不一致
- 为什么更改IIS网页的IP后用这个IP进不了网页?
- iframe 框架里面的htm页面调用是成功了,但是htm的视屏播放没有实现,不知道什么原因(求助)
- ASP.NET服务器控件的生命周期
- dataGrid的问题!!急!!
- 点击TreeView控件时闪烁(好象是在刷新)的很厉害,如何让它不闪烁?
- ASP.NET 运行时错误: 此上下文中不支持代码块。
- CR报表的设计遇到换行问题
如:string str="";
str="<table><tr><td>列名</td>";
for(int i=0;i<=list;i++)
{
str+="";
}response.write(str);
'your business logic operation
rsa.movenext
loop要注意的是,do while...loop和while...wend的不同之处在于,前者是先不判断就直接进行一次操作,完了再回到while判断是否执行下一次,而后者则是从进入循环前每次都要判断
if not rs.eof then
tempcontent=tempcontent&" <tr>"
tempcontent=tempcontent&" <td height=20 valign=top> <img src=news/images/pot_"&s_pic&".gif align=absmiddle>"
tempcontent=tempcontent&" <a href='news/news/view.asp?id="&rsa("id")&"' target=_blank title='"&rsa("title")&"'>"&atempTitle&"</a>"&o_char&newimg&hot
tempcontent=tempcontent&" </td>"
tempcontent=tempcontent&" </tr>"
rsa.movenext
loop
rsa.close
set rsa = nothing我这样写了,可是出不来效果???
<!--#include file="../inc/setup.asp" -->
<!--#include file="../inc/CheckClass.inc.asp" -->
<!--#include file="../dbconnect/news.inc.asp" --><%
s_cataid=RtnReplaceInt(trim(request("cataid")),0)
s_words=RtnReplaceInt(trim(request("words")),15)
s_num=RtnReplaceInt(trim(request("num")),8)
s_pic=RtnReplaceInt(trim(request("pic")),7)
s_pica=RtnReplaceInt(trim(request("pica")),8)
s_count=RtnReplaceString(trim(request("l_c")))
s_date=RtnReplaceString(trim(request("l_d")))
s_more=RtnReplaceString(trim(request("l_m")))
s_special=RtnReplaceString(trim(request("l_s")))
if s_cataid <> 0 then
set rsk=server.CreateObject("adodb.recordset")
sqlk="Select * from newscata where id="&s_cataid
rsk.Open sqlk,conn,1,3
if not rsk.eof then
krootid = rsk("rootid")
ktitle =rsk("title")
end if
rsk.close
set rsk=nothing
end if allcataid = ""
if s_cataid <> 0 then
set rsm=server.CreateObject("adodb.recordset")
sqlm="Select * from newscata"
rsm.Open sqlm,conn,1,3
do while not rsm.eof
mrootid = rsm("rootid")
gotoid = rsm("id")
if InStr(krootid,",") < 1 then
mmrootid = split(mrootid,",")
if mmrootid(0) = krootid then
allcataid = allcataid&" or cataid =" &gotoid
end if
else
if InStr(mrootid,krootid) > 0 then
allcataid = allcataid&" or cataid =" &gotoid
end if
end if
rsm.movenext
loop
rsm.close
set rsm = nothing
end if
allcataid = trim(Mid(allcataid,4))
tempcontent="<table cellspacing=0 cellpadding=0 width=94% align=center border=0>"
tempcontent=tempcontent&" <tbody>"
tempcontent=tempcontent&" <tr>"
tempcontent=tempcontent&" <td height=4></td>"
tempcontent=tempcontent&" </tr>" set rsa=server.createobject("adodb.recordset")
sqlm="Select * from newscata"
rsm.Open sqlm,conn,1,3
if s_special ="ok" then
if s_cataid = 0 then
sqla = "select Top "&s_num&" * from news where special order by sortid desc"
sqlh = "select Top 3 * from news where special order by hits desc"
else
sqla = "select Top "&s_num&" * from news where ("&allcataid&") and special order by sortid desc"
sqlh = "select Top 3 * from news where ("&allcataid&") and special order by hits desc"
end if
else
if s_cataid = 0 then
sqla = "select Top "&s_num&" * from news order by sortid desc"
sqlh = "select Top 3 * from news order by hits desc"
else
sqla = "select Top "&s_num&" * from news where ("&allcataid&") order by sortid desc"
sqlh = "select Top 3 * from news where ("&allcataid&") order by hits desc"
end if
end if
rsa.Open sqla,conn,1,3
if rsa.EOF or rsa.BOF then
tempcontent=tempcontent&" <tr><td>暂时没有任何信息!</td></tr>"
end if
do while not rsa.EOF
if len(Trim(rsa("title")))>cint(s_words) then
atempTitle = Left(RtnReplaceString(Trim(rsa("title"))),s_words)&"..."
else
atempTitle =RtnReplaceString(Trim(rsa("title")))
end if
if s_count = "ok" then
if s_date= "ok" then
o_char ="["&FormatDateTime(rsa("addtime"),vbshortdate)&" 浏览:"&rsa("hits")&"]"
else
o_char ="[浏览:"&rsa("hits")&"]"
end if
else
if s_date= "ok" then
o_char ="["&FormatDateTime(rsa("addtime"),vbshortdate)&"]"
else
o_char =""
end if
end if
if cdate(FormatDateTime(rsa("addtime"),vbshortdate)) = cdate(FormatDateTime(now(),vbshortdate)) or cdate(FormatDateTime(rsa("addtime"),vbshortdate))+1 = cdate(FormatDateTime(now(),vbshortdate)) then
newimg=" <img src=news/images/new.gif align=absmiddle>"
else
newimg=""
end if
hot=""
set rsh=server.createobject("adodb.recordset")
rsh.Open sqlh,conn,1,3
do while not rsh.eof
if rsa("id")=rsh("id") and not(cdate(FormatDateTime(rsa("addtime"),vbshortdate)) = cdate(FormatDateTime(now(),vbshortdate)) or cdate(FormatDateTime(rsa("addtime"),vbshortdate))+1 = cdate(FormatDateTime(now(),vbshortdate))) then
hot=" <img src=news/images/hot1.gif align=absmiddle>"
end if
rsh.movenext
loop
rsh.close
set rsh=nothing
do while ’想用这个循环语句,实现新闻循环调用
tempcontent=tempcontent&" <tr>"
tempcontent=tempcontent&" <td height=20 valign=top> <img src=news/images/pot_"&s_pic&".gif align=absmiddle>"
tempcontent=tempcontent&" <a href='news/news/view.asp?id="&rsa("id")&"' target=_blank title='"&rsa("title")&"'>"&atempTitle&"</a>"&o_char&newimg&hot
tempcontent=tempcontent&" </td>"
tempcontent=tempcontent&" </tr>"
rsa.movenext
loop
rsa.close
set rsa = nothingdo while ’想用这个循环语句,实现新闻循环调用
怎么写啊?
rsa.movenext
loop
rsa.close
set rsa = nothing
'结束后,输出变量,你用的是变量
Response.Write(tempcontent)