急急急........

gezhou 2003-09-17 04:12:05
<%@ language=vbscript %>
<!-- #include file="conn.asp" -->
<%
dim cha,d1,d2
cha=trim(request.form("cha"))
d1=trim(request("r1"))
d2=trim(request("r2"))
if cha="" then
cha = request("cha")
end if
if d1="" then
cha = request("d1")
end if
if d2="" then
cha = request("d2")
end if
set rs=server.createobject("adodb.recordset")
if cha<>"" then
sql="select * from chanpin where id like '%" & cha & "%'"
else
if d1="" and d2="" then
response.write "请输入关键字!"
else
sql="select * from chanpin where dt>=cdate('"&d1&"') and dt<=cdate('"&d2&"')"
end if
end if
rs.open sql,conn,1,1
if rs.recordcount<1 then
%>
对不起无资料
<%
else
rs.pagesize =2
page = request("page")
%>
<table width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100">
<div align="center">定单号</div></td>
<td width="100">
<div align="center">提交时间</div></td>
<td width="100"><div align="center">状态</div></td>
<td width="100">
<div align="center">定单总额</div></td>
<td width="100">
<div align="center">结算价总额</div></td>
<td width="100">
<div align="center">打印</div></td>
<td width="100">
<div align="center">执行情况</div></td>
</tr>
<%
if page <> "" and isnumeric(page) then
page = cint(page)
if page <= 1 then page = 1
if page > rs.pagecount then page = rs.pagecount
else
page = 1
end if
rs.absolutepage = page
pagecounts=rs.pagecount
for i=1 to rs.pagesize
%>
<tr>
<td><div align="center"><%=rs("id")%></div></td>
<td><div align="center"><%=rs("dt")%></div></td>
<td width="100">
<div align="center"></div></td>
<td><div align="center"><%=rs("zongjia")%></div></td>
<td><div align="center"><%=rs("shijia")%></div></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
end if
%>
<table width="800" border="0" cellpadding="0" cellspacing="0">
<tr><td><div align="right">共有<%=rs.recordcount%>条记录</div></td></tr>
<tr>
<td><div align="right">
<form method="post" action="ddc.asp" name="form1">
<%first_page="第一页"
previous_page="上一页"
next_page="下一页"
end_page="尾页"
if Page = 1 then
response.write first_page&" "&previous_page&" "
end if
if Page > 1 then
response.write "<a

href='javascript:form1.page.value=1;form1.submit();'>"&first_page&"</a> <a href='javascript:form1.page.value=" &

(page-1) & ";form1.submit();'>"&previous_page&"</a> "
end if
if page < pagecounts then
response.write "<a href='javascript:form1.page.value=" & (page+1) &

";form1.submit();'>"&next_page&"</a> <a href='javascript:form1.page.value=" & pagecounts&

";form1.submit();'>"&end_page&"</a>"
end if
if page >= pagecounts then
response.write next_page&" "&end_page
end if%>
<input type="hidden" name="page" value="<%=page%>">
<input type="hidden" name="cha" value="<%=cha%>">
<input type="hidden" name="d1" value="<%=d1%>">
<input type="hidden" name="d2" value="<%=d2%>">
</form>
</div></td>
</tr>
</table>
</table>
为什么每到翻页的时候就没有记录了 另外 第一次查询的时候还说有多条记录 还应有下一页
...全文
90 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
johnnywang1980 2003-09-17
  • 打赏
  • 举报
回复
在你要翻页的地方CALL一下。
gezhou 2003-09-17
  • 打赏
  • 举报
回复
怎么用的 不会用sub
xxrl 2003-09-17
  • 打赏
  • 举报
回复

<%
'+++++++++++++++++++++++++++++++++++++
'◆模块名称: 公共翻页模块
'◆文 件 名: TurnPage.asp
'◆传入参数: Rs_tmp (记录集), PageSize (每页显示的记录条数)
'◆输 出: 记录集翻页显示功能
'+++++++++++++++++++++++++++++++++++++
'
Sub TurnPage(ByRef Rs_tmp,PageSize) 'Rs_tmp 记录集 ; PageSize 每页显示的记录条数;
Dim TotalPage '总页数
Dim PageNo '当前显示的是第几页
Dim RecordCount '总记录条数
Rs_tmp.PageSize = PageSize
RecordCount = Rs_tmp.RecordCount
TotalPage = INT(RecordCount / PageSize * -1)*-1
PageNo = Request.QueryString ("PageNo")
'直接输入页数跳转;
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
'如果没有选择第几页,则默认显示第一页;
If PageNo = "" then PageNo = 1
If RecordCount <> 0 then
Rs_tmp.AbsolutePage = PageNo
End If

'获取当前文件名,使得每次翻页都在当前页面进行;
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得当前的文件名称,使翻页的链接指向当前文件;
fileName = Mid(fileName,postion)
%>
<table border=0 width='100%'>
<tr>
<td align=left> 总页数:<font color=#ff3333><%=TotalPage%></font>页
当前第<font color=#ff3333><%=PageNo%></font>页</td>
<td align="right">
<%If RecordCount = 0 or TotalPage = 1 Then
Response.Write "首页|前页|后页|末页"
Else%>
<a href="<%=fileName%>?PageNo=1">首页|</a>
<%If PageNo - 1 = 0 Then
Response.Write "前页|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo-1%>">前页|</a>
<%End If

If PageNo+1 > TotalPage Then
Response.Write "后页|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo+1%>">后页|</a>
<%End If%>

<a href="<%=fileName%>?PageNo=<%=TotalPage%>">末页</a>
<%End If%></td>
</tr>
</table>
<%End Sub%>

xxrl 2003-09-17
  • 打赏
  • 举报
回复
为什么不用翻页模板?没有?我找给你

28,406

社区成员

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

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