asp循环行数输出函数

时间:2021-05-28

经过大鸟哥的指导已做全面的修改,本人能力有限只能做到下面这步了:

ASP/VisualBasic代码
复制代码 代码如下:
<%
Constp=6'每页2条
setrs=server.createobject("adodb.recordset")
sql="Select*fromshoworderbyidDesc"
rs.Opensql,conn,1

i=0
dowhilenotrs.eof
%><tdalign="center"height="98">
<ahref="show.asp?id=<%=rs("id")%>">
<imgsrc="<%=rs("pic")%>"width="150"height="98"alt="<%=rs("name")%>"/></a>
</td>
<%
If(i+1)Mod3=0Then
Response.Write"</tr>"
Ifi<(p-1)ThenResponse.Write"<tr>"
EndIf
i=i+1
ifi>pthenexitdo
rs.movenext
Loop
IfiMod3<>0Then
Form=3-(iMod3)To1Step-1
response.write"<td></td>"
Next
response.write"</tr>"
EndIf
Ifi=3Then
response.write"<td></td><td></td><td></td></tr>"
Endif
rs.close
setrs=nothing
%>



之前的代码未更改

复制代码 代码如下:
<%
Constp=6'每页2条
setrs=server.createobject("adodb.recordset")
sql="Select*fromshoworderbyidDesc"
rs.Opensql,conn,1

i=1
dowhilenotrs.eof
%><tdalign="center"height="98">
<ahref="show.asp?id=<%=rs("id")%>">
<imgsrc="<%=rs("pic")%>"width="150"height="98"alt="<%=rs("name")%>"/></a>
</td>
<%
ifimod3=0then
Response.Write("</tr><tr>")
endif
i=i+1
ifi>pthenexitdo
rs.movenext
Loop
rs.close
setrs=nothing
%>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章