页面分页显示的问题,点击下一页,下面并没有调新的信息出来!!帮帮忙!!!

datongshijie 2003-11-20 12:11:14
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<title>文件查询</title>
<head>
<%
const MaxPerPage=3
dim sql
dim rs
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim page
page=1
%>
</head>
<body>
<%
word=trim(request("word"))
dim mycon,con
Set con=Server.CreateObject("ADODB.Connection")
mycon= "DRIVER=Microsoft Access Driver (*.mdb);DBQ="&Server.MapPath("/zhu.mdb")
con.open mycon

set rs=server.createobject("ADODB.Recordset")
rs.open "select Detail,Title,Date from new where id like '%"&word&"%'order by Date desc",MyCon,1,1
if not(rs.eof and rs.bof) then
rs.movefirst
end if

rs.pagesize=MaxPerPage
howmanyfields=rs.Fields.Count-1


If trim(Request("word"))<>"" then
CurrentPage= page
If CurrentPage> rs.PageCount then
CurrentPage = rs.PageCount
End If
Else
CurrentPage= 1
End If

if rs.eof then
response.write "<p align='center'> 没有查到要查的记录!</p>"
else
totalPut=rs.recordcount
if CurrentPage<>1 then
if (currentPage-1)*MaxPerPage<totalPut then
rs.move(currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
end if
end if

dim n,k
if (totalPut mod MaxPerPage)=0 then
n= totalPut \ MaxPerPage
else
n= totalPut \ MaxPerPage + 1
end if%>
</FONT></P>
<P>    第<%=currentpage%>页,共<%=n%>页。共找到<%=rs.recordcount%> 条符合条件的纪录。</P>
<P>   
<% k=currentPage
if k<>1 then
response.write "[<b>"+"<a href='dongtai6.asp?page=1'>首页</a></b>] "
response.write "[<b>"+"<a href='dongtai6.asp?page="+cstr(k-1)+"&word="+word+"'>上一页</a></b>] "
else
Response.Write "[首页] [上一页]"
end if
if k<>n then
response.write "[<b><a href='dongtai6.asp?page="+cstr(k+1)+"&word="+word+"'>下一页</a></b>] "
response.write "[<b><a href='dongtai6.asp?page="+cstr(n)+"&word="+word+"'>尾页</a></b>] "
else
Response.Write "[下一页] [尾页]"
end if
%>
</P>

<%

For i = 1 to rs.PageSize
if rs.EOF then
Exit For
end if '利用for next 循环依次读出记录
%>
<table width=95% border=0 align=center cellpadding="0" cellspacing="1">
<tr>
<td width="2%" height="17"><img src="images/dot.gif" width="6" height="6" border="0"></td>
<td width="3%" height="17"><img src="images/arrow.gif" width="5" height="5"></td>
<td width="443" height="17"><% =rs("Detail") %><br>
</td>
<td width="74" height="17"><% =rs("Date") %></td>

</tr> </table>
<%
rs.MoveNext
Next
%>

<%
end if
rs.close
set rs=nothing
%>
</body>
</html>
...全文
150 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
datongshijie 2003-11-20
  • 打赏
  • 举报
回复
rs.pagesize=MaxPerPage
注意更改MaxPerPage


怎么改!!初学,麻烦你详细点可以吗
zzzzzzzzzzzzz 2003-11-20
  • 打赏
  • 举报
回复
你的代码不正确,看一下这个


<%
Dim PgSz,Total,PageNo,Recount
PgSz=40
yeartextfield=request("yeartextfield")
moonselect=request("moonselect")
dayselect2=request("dayselect2")
C1=request("C1")
C2=request("C2")
%>


<%
Set Conn = Server.CreateObject("Adodb.Connection")
StrOpen = "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("..\..\database\update.mdb")
Conn.Open StrOpen

set updateInfo = server.createobject("adodb.recordset")
if C1 = "V3" Then
if C2 = "V4" then
sql="select serial,date from planar"
else
sql="select serial,date from updateInfo"
end if
else
if C2 = "V4" then
sql="select serial,date from planar where data = #" & yeartextfield & "-" & moonselect & "-" & dayselect2 & "#"
else
sql="select serial,date from updateInfo where data = #" & yeartextfield & "-" & moonselect & "-" & dayselect2 & "#"
end if
end if
updateInfo.Open sql,conn,3,3
%>

<%
updateInfo.PageSize=Cint(PgSz)
Total=updateInfo.pagecount
Recount = updateInfo.Recordcount

PageNo=trim(Request("PageNo"))

if PageNo="" then
PageNo=1
end if
PageNo = Cint(PageNo)
if PageNo < 1 then
PageNo=1
end if
if PageNo > Total then
PageNo=Total
end if
'Response.redirect("InFormtion.asp?word=" & PageNo)
if PageNo >= 1 then
updateInfo.AbsolutePage=PageNo
end if
RowCount = updateInfo.PageSize
%>

<% while not updateInfo.eof and RowCount > 0 %>
<tr bgcolor="#FFFFFF">
<td height="8" width="106"><a href="usedetails.asp?checkusetxt=<% = updateInfo("serial") %>">
<p align="center"> <% = updateInfo("serial") %> </a></td>
<td height="8" width="173">
<p align="center">
<% = updateInfo("date") %>
</td>
</tr>
<%
RowCount = RowCount - 1
updateInfo.movenext
wend

updateInfo.close
set updateInfo=nothing
Conn.close
set conn=nothing

%>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" height="26">
<tr bgcolor="#FFFFFF">
<td height="8" width="455">

 
<font color=#666666>[共<% =Total %>页]</font>
<font color=#666666>[第<% =PageNo %>页]</font>
<font color=#666666>[共<% =Recount %>记录]      </font>
<font color=#666666>[<a href="listser.asp?PageNo=1&yeartextfield=<% =yeartextfield %>&moonselect=<% =moonselect %>&dayselect2=<% =dayselect2 %>&c1=<% =c1 %>&c2=<% =c2 %>">首页</a>]</font>
<font color=#666666>[<a href="listser.asp?PageNo=<%=PageNo-1%>&yeartextfield=<% =yeartextfield %>&moonselect=<% =moonselect %>&dayselect2=<% =dayselect2 %>&c1=<% =c1 %>&c2=<% =c2 %>">上一页</a>]</font>
<font color=#666666>[<a href="listser.asp?PageNo=<%=PageNo+1%>&yeartextfield=<% =yeartextfield %>&moonselect=<% =moonselect %>&dayselect2=<% =dayselect2 %>&c1=<% =c1 %>&c2=<% =c2 %>">后一页</a>]</font>
<br>
 
<font color=#666666>[共有<% =kk %>个验证码使用]</font>
</td>
<td height="8" width="41">
<p align="center"><font color=#666666>[<a href="displayser.asp">返回</a>]</font>

</p>

</td>
</tr>
</table>
freetaiger 2003-11-20
  • 打赏
  • 举报
回复
因为你的记录集锁顶了
rs.pagesize=MaxPerPage
注意更改MaxPerPage就可以了
datongshijie 2003-11-20
  • 打赏
  • 举报
回复
谢谢各位
datongshijie 2003-11-20
  • 打赏
  • 举报
回复
:(哦 !!
谢谢提醒!!!
xyzoem2 2003-11-20
  • 打赏
  • 举报
回复
晕倒,从c语言开始重新学吧(最经典,全面)
datongshijie 2003-11-20
  • 打赏
  • 举报
回复
嘿嘿!!如果以前只会做静态页面!!你觉着能看懂吗?
else

end if

到现在为止具体怎么对应我还不太清楚呢
嘿嘿!!编程得书还没接触过呢!!这是第一次抄别人的代码作点东西

向这些我还能记住样子

if Not IsEmpty(Request("Page")) then '如果PAGE已经初始化...

Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量

if Page > rs.PageCount then '如果接收的页数大于总页数
Page = rs.PageCount '设置当前显示页等于最后页
elseif Page <= 0 then '如果page小于等于0
xyzoem2 2003-11-20
  • 打赏
  • 举报
回复
C1 = "V3"时
搜索全部数据
否则搜索给定时间的数据(没看源代码,说错勿怪)
这些东西自己看一下应该就会了吧
datongshijie 2003-11-20
  • 打赏
  • 举报
回复
我试了你的了,嘿嘿!!好使!!!
顺便问一句



if C1 = "V3" Then
if C2 = "V4" then
sql="select serial,date from planar"
else
sql="select serial,date from updateInfo"
end if
else
if C2 = "V4" then
sql="select serial,date from planar where data = #" & yeartextfield & "-" & moonselect & "-" & dayselect2 & "#"
else
sql="select serial,date from updateInfo where data = #" & yeartextfield & "-" & moonselect & "-" & dayselect2 & "#"
end if
end if



这些是什么意思

28,407

社区成员

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

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