| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 416 人关注过本帖
标题:查询结果分页出错,求帮助
只看楼主 加入收藏
wwm123456789
Rank: 4
等 级:业余侠客
帖 子:63
专家分:204
注 册:2010-4-4
结帖率:92.86%
收藏
已结贴  问题点数:20 回复次数:2 
查询结果分页出错,求帮助
程序代码:
<%date1=CDate(request("date1"))
date2=CDate(request("date2"))
set rs = Server.createobject("adodb.recordset")
sql = "SELECT * FROM [rkb] WHERE rksj between#"&date1&"# and #"&date2&"# "
rs.open sql,conn,1,1
If rs.Eof Then
Else
  rs.PageSize=15 page= request("page")
  If Not Isnumeric(page) or page="" Then
    page=1
   else
    page=cint(page)
  End if
  If page<1 Then page=1
  If page>rs.pagecount Then page=rs.pagecount
  rs.AbsolutePage = page
  For i=1 To rs.pagesize
  id = rs("id")
  name = rs("name")
  xh = rs("xh")
  dw = rs("dw")
  sl = rs("sl")
  dj = rs("dj")
  yt = rs("yt")
  gmr = rs("gmr")
  bgr = rs("bgr")
  lysj = rs("rksj")%>

 <tr>
    <td><%=rs("id")%></td>
    <td><%=rs("name")%></td>
    <td><%=rs("xh")%></td>
    <td><%=rs("dw")%></td>
    <td><%=rs("sl")%></td>
    <td><%=rs("dj")%></td>
    <td><%=rs("yt")%></td>
    <td><%=rs("gmr")%></td>
    <td><%=rs("bgr")%></td>
    <td><%=rs("rksj")%></td>
    <td><a href="rkedit.asp?id=<%=rs("id")%>">修改</a></td>
    <td><a href="javascript:if (confirm('确定要删除该记录?')) {location.href='rkdelet.asp?id=<%=rs("id")%>'}">
删除</a></td>
  </tr>
  <%rs.movenext
  If rs.Eof then
     Exit For
  End if
  Next
End If
Call fpage("date1|date2",rs.recordcount,page,rs.pagecount,rs.pagesize)  '这里面分页函数
rs.close
set rs = nothing
%>
<%Function fpage(str,recordcount,page,pagecount,pagesize)
s=Split(str,"|")
s2=""
For i=0 To UBound(s)
s2=s2&"&"&s(i)&"="&request(s(i))
next
response.write "<table width=""100%"" cellpadding=0 cellspacing=0 border=0>"
response.write " <tr>"
response.write " <td align=""center"" width=""95%"">&nbsp;&nbsp;记录总数:"&recordcount&"条 页次:"&page&"/"&pagecount&"" & pagesize & "个/页"
If page<=1 Then
response.write " 首&nbsp;页 上一页 "
Else
response.write " <a href=""?page=1"&s2&"""><font color='#ff0000'>首&nbsp;页</font></a> <a href=""?page="&(page-1)&s2&"""><font color='#ff0000'>上一页</font></a> "
End If
If page>=pagecount Then
response.write "下一页 尾&nbsp;页 "
Else
response.write "<a href=""?page="&(page+1)&s2&"""><font color='#ff0000'>下一页</font></a> <a href=""?page="&pagecount&s2&"""><font color='#ff0000'>尾&nbsp;页</font></a> "
End If
response.write "&nbsp;<select name=""page"" onchange=""spage(this.value)"">"
For i=1 To pagecount
response.write "<option value="&i
If CInt(page)=CInt(i) Then response.write " selected"
response.write ">第"&i&"页</option>"&vbnewline
next
response.write "</select>"&vbnewline
response.write "</td> "&vbnewline
response.write " <td width=""5%""></td>"&vbnewline
response.write " </tr>"&vbnewline
response.write "</table>"&vbnewline
response.write "<script language=""javascript"">"&vbnewline
response.write "function spage(id)"&vbnewline
response.write "{"&vbnewline
response.write "location.href=""?page=""+id+"""&s2&""";"&vbnewline
response.write "}"&vbnewline
response.write "</script>"&vbnewline
End function
%>
提示
rs.PageSize=15 page= request("page")
语句未结束,请指教,谢谢!
搜索更多相关主题的帖子: color 查询 
2012-02-22 11:39
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:20 
rs.PageSize=15 : page= request("page")
或者
 rs.PageSize=15
 page=request("page")
2012-02-22 12:39
wwm123456789
Rank: 4
等 级:业余侠客
帖 子:63
专家分:204
注 册:2010-4-4
收藏
得分:0 
谢谢版主,解决!
2012-02-22 18:39
快速回复:查询结果分页出错,求帮助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.037361 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved