100分求一个分页代码

heijunma 2005-06-28 08:16:26
网址:
http://www.hzrtvu.edu.cn/kf/tj/admin/wlzx_zbrz_search.asp

我想知道wlzx_zbrz_search.asp的源代码,或者给一个能完成同样显示格式的分页代码也行.
...全文
353 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
heijunma 2005-06-29
  • 打赏
  • 举报
回复
to 蚊子
不是我要的那样效果
heijunma 2005-06-29
  • 打赏
  • 举报
回复
to 白夜花寒
唉,可惜看不懂.我刚学.我想马上就能用.学会再用就来不及了.不过还是谢谢你.
to wcbm
都说比较简单,就不能给我贴个完整的代码吗?
wcbm 2005-06-29
  • 打赏
  • 举报
回复
其实我看也比较简单啊

你要的是一页显示三条记录,哪个网页都可以找到分页的源代码啊,
你只要把每页显示的条数改成3就可以了

关于每页输出三个表格的问题,你就只要把每条记录改成一个表格来显示就可以了

然后再在表格里加入相应的字段,当然,这个表格也是要放在循环里的
itzhiren 2005-06-29
  • 打赏
  • 举报
回复
这是绝对可以的了,我已经在本地测试通过!
itzhiren 2005-06-29
  • 打赏
  • 举报
回复
你可以把数据改成你自己的:

<!--#include file="dbconn.asp"-->

<body bgcolor="#b9befb">
<center><font face="Times New Roman"><b>联系人</b></font></center>
<a href="mnew.asp"><font size="2">添加</font></a><font size="2"><br>
</font>
<%
sql="select * from mates order by name"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
session("name")=rs("name")
if not rs.eof then
rs.pagesize=2
page=request.querystring("currentpage")
if page="" then page=1
rs.AbsolutePage=cint(page)
%>
<div align="center">
<center>
<%do while not rs.eof and size<rs.pagesize%> </font>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr align="center">
<td><font size="2">姓名</font></td>
<td><font size="2">性别</font></td>
<td><font size="2">家庭电话</font></td>
<td><font size="2">办公电话</font></td>
<td><font size="2">移动电话</font></td>
<td><font size="2">居住地址</font></td>
<td><font size="2">公司名称</font></td>
<td><font size="2">公司地址</font></td>
<td><font size="2">职位</font></td>
<td colspan=2><font size="2">操作</td>
</tr>
<tr align="center" font size=2>
<td><font size="2">
<%=rs("name")%> </font> </td>
<td><font size="2">
<%=rs("sex")%></font> </td>
<td><font size="2">
<%=rs("home_tel")%> </font> </td>
<td><font size="2">
<%=rs("company_tel")%> </font> </td>
<td><font size="2">
<%=rs("mobile")%> </font> </td>
<td><font size="2">
<%=rs("home_address")%> </font> </td>
<td><font size="2">
<%=rs("company_name")%> </font> </td>
<td><font size="2">
<%=rs("company_address")%> </font> </td>
<td><font size="2">
<%=rs("zhiwei")%> </font> </td>
<td align=center><a href="mmod.asp?name=<%=rs("name")%>"><font size="2">修改</font></a></td>
<td align=center><a href="mdel.asp?name=<%=rs("name")%>"><font size="2">删除</font></a></td>
</tr></table><BR>
<%rs.movenext
size=size+1
loop%> </font>

</center>
</div>
<table border=0 width=95%>
<tr>
<td><font size="2">共<%=rs.pagecount%>页</td>
<% if page=1 then%> </font>
<td><font size="2">首页</font></td><td><font size="2">上一页</td>
<%else%> </font>
<td><a href=mate.asp?currentpage=1><font size="2">首页</font></a></td>
<td><a href=mate.asp?currentpage=<%=page-1%> ><font size="2">上一页</font></a><font size="2"></td>
<%end if%>

<%if cint(page)=rs.pagecount then%> </font>
<td><font size="2">下一页</font></td><td><font size="2">尾页</td>
<%else%> </font>
<td><a href=mate.asp?currentpage=<%=page+1%>><font size="2">下一页</font></a></td>
<td><a href=mate.asp?currentpage=<%=rs.pagecount%>><font size="2">尾页</font></a><font size="2"></td>
</tr>

<%end if%>
<%end if%> </font>
</tabel>

</table>

</body>

白夜花寒 2005-06-29
  • 打赏
  • 举报
回复
我给你看看我做的...一个分页出table的,不过异常复杂,完全可以的,比你的这个要求要复杂不少....

private sub createtable(rs) '建立冲印篮里的表格
dim str
dim i : i=1
dim tablepicstr
while not rs.eof
' response.write "ok"
redim Preserve thetableshow(i)
tablepicstr=tablepicshow(i,rs("width"),rs("height"),rs("thepicid")) '看看addbagshow的这个存储过程了
itemkindstr=itemshow(i,rs("thepicid"))
delstr=dellink(rs("ordpicid"))
thetableshow(i-1)="<table>"
thetableshow(i-1)=thetableshow(i-1) & "<tr>"
thetableshow(i-1)=thetableshow(i-1) & "<td >"
thetableshow(i-1)=thetableshow(i-1) & "<table height='100%'>"
thetableshow(i-1)=thetableshow(i-1) & "<tr>"
thetableshow(i-1)=thetableshow(i-1) & "<td>"
thetableshow(i-1)=thetableshow(i-1) & "<a href='dingdan/" & ordercode & "/" & rs("picname") & ".jpg' target='_blank'>"
thetableshow(i-1)=thetableshow(i-1) & "<img src='dingdan/" & ordercode & "/" & rs("picname") & "a.jpg' border='0'>" '这个应该是冲印篮中的相片
thetableshow(i-1)=thetableshow(i-1) & "</a><br />"
thetableshow(i-1)=thetableshow(i-1) & "<input type='hidden' name='picid' value='" & rs("thepicid") & "'>"
thetableshow(i-1)=thetableshow(i-1) & rs("thesrcname")
thetableshow(i-1)=thetableshow(i-1) & "</td>"
thetableshow(i-1)=thetableshow(i-1) & "</tr>"
thetableshow(i-1)=thetableshow(i-1) & "</table>"
thetableshow(i-1)=thetableshow(i-1) & "</td>"
thetableshow(i-1)=thetableshow(i-1) & "<td>"
thetableshow(i-1)=thetableshow(i-1) & tablepicstr
thetableshow(i-1)=thetableshow(i-1) & "</td>"
thetableshow(i-1)=thetableshow(i-1) & "<td>"
thetableshow(i-1)=thetableshow(i-1) & itemkindstr
thetableshow(i-1)=thetableshow(i-1) & "</td>"
thetableshow(i-1)=thetableshow(i-1) & "<td>"
thetableshow(i-1)=thetableshow(i-1) & delstr
thetableshow(i-1)=thetableshow(i-1) & "</td>"
thetableshow(i-1)=thetableshow(i-1) & "<tr>"
thetableshow(i-1)=thetableshow(i-1) & "</table>"
rs.movenext
i=i+1
wend
'createtable=str
end sub

private function dellink(thepicid)
str="<table height='100%'>"
str=str & "<tr>"
str=str & "<td>"
str=str & "<a href='del.asp?ordpicid=" & thepicid & "'>删除</a>"
str=str & "</td>"
str=str & "</tr>"
str=str & "</table>"
dellink=str
end function

分页的话,可以用rs的几个属性的,以前的access的代码我已经找不到了,很不好意思
heijunma 2005-06-29
  • 打赏
  • 举报
回复
to 白夜花寒
你的ID怎么是中文的?一看就是高手啊
干脆你把http://www.hzrtvu.edu.cn/kf/tj/admin/wlzx_zbrz_search.asp这个文件的代码告诉我吧,别的我也不用了.可以吗?

zwrtv 2005-06-29
  • 打赏
  • 举报
回复
路过学习下
zhanghongwen 2005-06-29
  • 打赏
  • 举报
回复
<%
db="data.asp"
set rs3=server.createobject("adodb.recordset")
set conn3=server.createobject("adodb.connection")
connstr3="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn3.open connstr3
sql3="select * from photo order by id desc"
rs3.open sql3,conn3,1,1
const maxperpage=18
dim sql,rs3,totalput,currentpage,i,listsql,strtype,strp_name,strp_type,strprice_s,strprice_e
rs3.pagesize=maxperpage
if trim(request("page"))<>"" then
currentpage=CLng(request("page"))
if currentpage>rs3.pagecount then
currentpage=rs3.pagecount
end if
else
currentpage=1
end if
if rs3.Eof then
response.write"对不起!还没有任何记录!"
else
totalput=rs3.recordcount
if currentpage<>1 then
if (currentpage-1)*maxperpage<totalput then
rs3.move(currentpage-1)*maxperpage
dim bookmark
bookmark=rs3.bookmark
end if
end if
dim n,k
if (totalput mod maxperpage)=0 then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if
%>
<%
k=currentpage
if k<>1 then
response.write"[<b>"+"<a href=xc.asp?page=1>第一页</a></b>]"
response.write"[<b>"+"<a href=xc.asp?page="+cstr(k-1)+">上一页</a></b>]"
else
response.write"[第一页][上一页]"
end if
if k<>n then
response.write"[<b>"+"<a href=xc.asp?page="+cstr(k+1)+">下一页</a></b>]"
response.write"[<b>"+"<a href=xc.asp?page="+cstr(n)+">最后一页</a></b>]"
else
response.write"[下一页][最后一页]"
end if
%>
zhanghongwen 2005-06-29
  • 打赏
  • 举报
回复
要不要我发给你呀.
白夜花寒 2005-06-29
  • 打赏
  • 举报
回复
^0^你的问题超级简单,但是我喜欢用复杂的方法解释。。。。否则就没有乐趣了,告诉你个最简单的

得到分页代码的方式,你用刷新 | 全文检索 | 搜索 | 提问| 搜索的功能去检索就能查询得到

的,而且是一搜一大把。。。。。。根本不用开帖的,8过既然你喜欢开帖我就喜欢答得有乐趣
heijunma 2005-06-29
  • 打赏
  • 举报
回复
唉,我真不知道是我表达不清楚还是各位理解有误.我已经说的很清楚了,我最想要的是怎么实现一页显示三条记录,一条记录输出在一个表格.也就是一页显示三个表格的代码.分页的代码随便一个对我来说就够用了.
heijunma 2005-06-29
  • 打赏
  • 举报
回复
to itzhiren
不好意思,我没仔细看.你的输出效果是我想要的.
zy51 2005-06-28
  • 打赏
  • 举报
回复
原来楼主要的是那样的功能啊.用for循环一下表格就行了啊.设置分页为3个记录分一页.

<%
rs.pagesize=3

for i = 1 to rs.pagesize
Response.write "<table border=1><tr><td>11</td></tr></table>"
next

%>
heijunma 2005-06-28
  • 打赏
  • 举报
回复
再解释一下:我想知道的是wlzx_zbrz_search.asp是如何把一条记录输出在一个表格的.我要的不是第一行是字段名,下面是数据这样的效果.
heijunma 2005-06-28
  • 打赏
  • 举报
回复
其实我要的就是显示记录的代码.不是分页的代码.
heijunma 2005-06-28
  • 打赏
  • 举报
回复
楼上大哥:
怎么用啊?我看不懂
白夜花寒 2005-06-28
  • 打赏
  • 举报
回复
<script language='vbscript'>
dim field_info,theexceptfield,tablename
function createsqlstr
dim str : str=""
str=str & "@num int" & "<br />"
str=str & "@page int" & "<br />"
for each thefieldname in field_info
str=str & "@" & field_info(thefieldname) & "<br />"
next
str=str & "@" & theexceptfield & "<br />"

str=str & "declare @thepage int" & "<br />"

str=str & "set @thepage=(@page-1) * @num" & "<br />"



str=str & "set @sql='select top '+cast(@num as nvarchar(30))+' * from " & tablename
i=1
for each thefieldname in field_info
if i=1 then str=str & " where "
str=str & field_info(thefieldname) & "='+cast(@" & field_info(thefieldname) & " as nvarchar(30))+' and "
i=i+1
next
str=str & theexceptfield & " not in(select top '+cast(@thepage as nvarchar(30))+'" & " " & theexceptfield
str=str & " from " & tablename & " where "
i=1
for each thefieldname in field_info
if i<>1 then str=str & " and "
str=str & field_info(thefieldname) & "='+cast(@" & field_info(thefieldname) & " as nvarchar(30))+'"
i=i+1
next
str=str & "order by " & theexceptfield &") order by " & theexceptfield & "'"
createsqlstr=str
end function


function setfieldnum
set thefieldname=document.getElementById("fieldname")
set thesetnum=document.getElementById("setnum")
thenum=thesetnum.value
if isnumeric(thenum) then
thenum=Cint(thenum)

str="请输入您所要查询的字段名:" & "<br />"
for i=0 to thenum-1
str=str & "字段" & i+1 & ":<input type='text' name='fieldnames' size='30' />" & "<br />"
next
str=str & "请输入您所用的标识字段名:" & "<input type='text' id='exceptfield' />" & "<br />"
str=str & "请输入表明:" & "<input type='text' id='tablenamed' />" & "<br />"
str=str & "<a href='vbscript:saveinfo()'>显示sql</a>"
thefieldname.innerHTML=str
end if
end function

function saveinfo()
set theshowsql=document.getElementById("showsql")
set thefieldnames=document.getElementsByName("fieldnames")
set the_exceptfield=document.getElementById("exceptfield")
set field_info=createobject("scripting.dictionary")
set thetablename=document.getElementById("tablenamed")
theexceptfield=the_exceptfield.value
tablename=thetablename.value
for i=0 to thefieldnames.length-1
thevalue=thefieldnames(i).value
field_info.add thevalue,thevalue
next
str=createsqlstr
theshowsql.innerhtml=str
end function
</script>
<html>
<head>
<base target="_self">
</head>
<body>
设定:<input type='text' id='setnum' size='2' />----<a href='vbscript:setfieldnum()'>确定</a>
<div id='fieldname'>
</div>
<div id='showsql'>
</div>
</body>
</html>

保存成hta自动完成存储过程分页
heijunma 2005-06-28
  • 打赏
  • 举报
回复
我想实现的是1条记录输出在一个表格里,比如一页显示3条记录.就输出三个表格.
要的是这样的效果:
http://www.hzrtvu.edu.cn/kf/tj/admin/wlzx_zbrz_search.asp
pzhuyy 2005-06-28
  • 打赏
  • 举报
回复
给你个网站:
http://www.blueidea.com/tech/program/2003/718.asp
里面有详细介绍!
加载更多回复(5)

28,391

社区成员

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

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