怎么让他执行

xiaofengxin01 2010-01-04 11:04:37
<%
set rs = server.CreateObject("adodb.recordset")
sql="select * from [表3] order by [自动编号] asc"
rs.open sql,conn,1,1
do while not rs.eof
%>
<%
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for 怎么让下面的程序执行
%>
<table width="291" height="272" border="1" cellpadding="1" cellspacing="0" bordercolor="#A3DBFF" id="xtable">
<tr>
<td width="125" align="center">照片</td>
<td width="27">编号</td>
<td width="125"><%=rs("id")%></td>
</tr>
<tr>
<td rowspan="6" align="center"><a href="<%=rs("xphoto")%>" rel="lightbox[plants]"> <img width="120" height="160" src="<%=rs("xphoto")%>" /></img></a></td>
<td>姓名</td>
<td><%=rs("xname")%></td>
</tr>
<tr>
<td>性别</td>
<td> </td>
</tr>
<tr>
<td>年龄</td>
<td>
<%
user=session("user")
if user="" Then
response.Write "**游客不显示**"
else
%>
<%=rs("xqq")%>
<%
end if
%> </td>
</tr>
<tr>
<td height="54" >电话</td>
<td>
<%
user=session("user")
if user="" Then
response.Write "**游客不显示**"
else
%>
<%=rs("xphone")%>
<%
end if
%></td>
</tr>
<tr>
<td height="54" >工作</td>
<td><%=rs("xwork")%></td>
</tr>
<tr>
<td height="36">现今<br />
地址</td>
<td><%=rs("xaddress")%></td>
</tr>
<tr>
<td height="48" align="center">其他信息</td>
<td colspan="2"><p><%=rs("xother")%></p></td>
</tr>
</table>
<%
rs.movenext()
next
%>
<p></p>
<div id="foot1"><a href="xdata.asp">首页</a>
<%if pre then%>
<a href="xdata.asp?page=<%=intpage -1%>">上页</a>
<%end if%>
<%if last then %>
<a href="xdata.asp?page=<%=intpage +1%>"> 下页</a>
<%end if %>
<a href="xdata.asp?page=<%=rs.PageCount%>">尾页</a>
<%
loop
conn.close()
%>
...全文
107 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
tank_pp 2010-01-04
  • 打赏
  • 举报
回复
<%
set rs = server.CreateObject("adodb.recordset")
sql="select * from [表3] order by [自动编号] asc"
rs.open sql,conn,1,1
if rs.bof or rs.eof then
else
rs.pagesize=10
page_total=rs.PageCount
'第一次显示没有页码,默认显示第一页
If Request("page")<>""Then
iPage=Cint(Request("page"))
If iPage <1 Then
iPage=1 '页码小于1,则显示第一页
End If
'当大于总页数的时候,显示最后一页
If iPage>page_total Then
iPage=page_total
Else
iPage=1
End If
End If
%>
<%
rs.AbsolutePage=iPage
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for '怎么让下面的程序执行
%>
<table width="291" height="272" border="1" cellpadding="1" cellspacing="0" bordercolor="#A3DBFF" id="xtable">
<tr>
<td width="125" align="center">照片 </td>
<td width="27">编号 </td>
<td width="125"> <%=rs("id")%> </td>
</tr>
<tr>
<td rowspan="6" align="center"> <a href=" <%=rs("xphoto")%>" rel="lightbox[plants]"> <img width="120" height="160" src=" <%=rs("xphoto")%>" /> </img> </a> </td>
<td>姓名 </td>
<td> <%=rs("xname")%> </td>
</tr>
<tr>
<td>性别 </td>
<td>  </td>
</tr>
<tr>
<td>年龄 </td>
<td>
<%
user=session("user")
if user="" Then
response.Write "**游客不显示**"
else
%>
<%=rs("xqq")%>
<%
end if
%> </td>
</tr>
<tr>
<td height="54" >电话 </td>
<td>
<%
user=session("user")
if user="" Then
response.Write "**游客不显示**"
else
%>
<%=rs("xphone")%>
<%
end if
%> </td>
</tr>
<tr>
<td height="54" >工作 </td>
<td> <%=rs("xwork")%> </td>
</tr>
<tr>
<td height="36">现今 <br />
地址 </td>
<td> <%=rs("xaddress")%> </td>
</tr>
<tr>
<td height="48" align="center">其他信息 </td>
<td colspan="2"> <p> <%=rs("xother")%> </p> </td>
</tr>
</table>
<%
rs.movenext()
next
%>
<p> </p>
<div id="foot1"> <a href="xdata.asp">首页 </a>
<%if pre then%>
<a href="xdata.asp?page= <%=intpage -1%>">上页 </a>
<%end if%>
<%if last then %>
<a href="xdata.asp?page= <%=intpage +1%>"> 下页 </a>
<%end if %>
<a href="xdata.asp?page= <%=rs.PageCount%>">尾页 </a>
<%
end if
conn.close()
%>
ninja 2010-01-04
  • 打赏
  • 举报
回复

<%
set rs = server.CreateObject("adodb.recordset")
sql="select * from [表3] order by [自动编号] asc"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
%>
<%
for i=0 to rs.pagesize-1
%>
<table width="291" height="272" border="1" cellpadding="1" cellspacing="0" bordercolor="#A3DBFF" id="xtable">
<tr>
<td width="125" align="center">照片 </td>
<td width="27">编号 </td>
<td width="125"> <%=rs("id")%> </td>
</tr>
<tr>
<td rowspan="6" align="center"> <a href=" <%=rs("xphoto")%>" rel="lightbox[plants]"> <img width="120" height="160" src=" <%=rs("xphoto")%>" /> </img> </a> </td>
<td>姓名 </td>
<td> <%=rs("xname")%> </td>
</tr>
<tr>
<td>性别 </td>
<td>  </td>
</tr>
<tr>
<td>年龄 </td>
<td>
<%
user=session("user")
if user="" Then
response.Write "**游客不显示**"
else
%>
<%=rs("xqq")%>
<%
end if
%> </td>
</tr>
<tr>
<td height="54" >电话 </td>
<td>
<%
user=session("user")
if user="" Then
response.Write "**游客不显示**"
else
%>
<%=rs("xphone")%>
<%
end if
%> </td>
</tr>
<tr>
<td height="54" >工作 </td>
<td> <%=rs("xwork")%> </td>
</tr>
<tr>
<td height="36">现今 <br />
地址 </td>
<td> <%=rs("xaddress")%> </td>
</tr>
<tr>
<td height="48" align="center">其他信息 </td>
<td colspan="2"> <p> <%=rs("xother")%> </p> </td>
</tr>
</table>
<%
rs.movenext()
next
%>
<p> </p>
<div id="foot1"> <a href="xdata.asp">首页 </a>
<%if pre then%>
<a href="xdata.asp?page= <%=intpage -1%>">上页 </a>
<%end if%>
<%if last then %>
<a href="xdata.asp?page= <%=intpage +1%>"> 下页 </a>
<%end if %>
<a href="xdata.asp?page= <%=rs.PageCount%>">尾页 </a>
<%
loop
end if
set rs=nothing
conn.close()
%>
bcuwater 2010-01-04
  • 打赏
  • 举报
回复
?
gxq323 2010-01-04
  • 打赏
  • 举报
回复
去掉if rs.bof or rs.eof then exit for 记录为空自动不执行了,还有就是
rs.movenext()
next 好像不用括号吧
yan11cn 2010-01-04
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lzp4881 的回复:]
if rs.bof or rs.eof then exit for  怎么让下面的程序执行
这里改成
if rs.bof and rs.eof then exit for
[/Quote]

if rs.bof or rs.eof then exit for是对的。。。
lzp4881 2010-01-04
  • 打赏
  • 举报
回复
if rs.bof or rs.eof then exit for 怎么让下面的程序执行
这里改成
if rs.bof and rs.eof then exit for

yan11cn 2010-01-04
  • 打赏
  • 举报
回复
for i=0 to rs.pagesize-1
这句中的rs.pagesize表示每页显示几条记录,是要你自己给他赋值的
比如:
rs.pagesize=10
for i=0 to rs.pagesize-1
ender129 2010-01-04
  • 打赏
  • 举报
回复
送你一些代码练习用的 正好跟你需要的相像 自己去改改吧

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="inc/Conn.asp" -->
<%response.charset="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from qwer order by id desc"
rs.Open sql,conn,1,1

if rs.eof and rs.bof then
response.Write("暂时没有记录")
else
%>
<%
rs.PageSize=10
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize
%>
<tr>
<td height="24" align="center" ><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td width="18%" rowspan="4" align="center"><img src="<%=rs("bq")%>" alt="" /></td>
<td width="82%" align="left">作者:<%=rs("UserName")%></td>
</tr>
<tr>
<td align="left">主题:<%=rs("Title")%></td>
</tr>
<tr>
<td align="left">时间:<%=rs("sj")%></td>
</tr>
<tr>
<td align="left"><%=rs("content")%></td>
</tr>
</table></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
<tr valign="bottom">
<td height="50" align="center" ><form method="post" action="?">
<%if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=Index.asp?page=1>首页</a> "
response.write "<a href=Index.asp?page=" & Page-1 & ">上一页</a> "
end if
if rs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=Index.asp?page=" & (page+1) & ">"
response.write "下一页</a> <a href=Index.asp?page="&rs.pagecount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
response.write " 共<b><font color='#FF0000'>"&rs.recordcount&"</font></b>条记录 <b>"&rs.pagesize&"</b>条记录/页"
response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">"
response.write " <input class=input type='submit' value=' Goto ' name='cndok'></span></p>"
%>
</form></td>
</tr>
<%
end if
rs.close
set rs=nothing
%>
</table>
</body>
</html>


<%
dim conn,db
dim connstr
db="database/aa.mdb" '数据库文件位置
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
sub CloseConn()
conn.close
set conn=nothing
end sub
%>
xiaofengxin01 2010-01-04
  • 打赏
  • 举报
回复
还是没有执行啊

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧