日期:2014-05-17  浏览次数:21091 次

一个有关分页的问题。
其实下面的代码是可以正常翻页的显示的。
但是只要加了红字部分,也就是代码:xsxx(rs("id")),这个功能就是通过该记录id去读个关联表的信息,结果就会出现分页错误,即第一页就不是显示10条记录而是多了很多记录。如果去掉这个自定义函数就正常了。百思不得其解望高手指点下。
<!--#include file="conn.asp"-->
<%

PagePubsay=10
dim search,sql,page
search=request("search")
sql="select * from Tscdb"

set rs=server.CreateObject("ADODB.RecordSet")  
rs.open sql ,conn,1,1,1
if not rs.eof then
rs.pagesize=PagePubsay
Rs.CacheSize=Rs.PageSize
end if
If Request("CurrentPage")="" Then
  CurrentPage=1
Else
  CurrentPage=Request("CurrentPage")
End If  
If Not(Rs.Eof And Rs.Bof) Then
  Rs.AbsolutePage=CurrentPage
End If

%>
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>测试</title>
<link href="x_img/style.css" rel="stylesheet" type="text/css">

</head>

<body>

<div align="center">
<table border="0" width="870" cellspacing="0" cellpadding="0" id="table2" height="620">

<tr>
<td width="860" bgcolor="#FFFFFF" rowspan="2" valign="top">
 <div align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table8" height="619">

<tr>
<td valign="top">
<div align="center">
<TABLE cellSpacing=0 cellPadding=0 width=860 border=1 bordercolorlight="#C0C0C0" bordercolordark="#EDEDED" style="border-collapse: collapse">
  <TBODY>
  <TR>
  <TD width=50 height=23 align=left bgcolor="#EDEDED" class="aa">
<p align="center">编号</TD>
  <TD width=93 height=23 align=center bgcolor="#EDEDED" class="aa">时间</TD>
  <TD width=84 height=23 align=center bgcolor="#EDEDED" class="aa">信息来源</TD>
  <TD width=234 height=23 align=center bgcolor="#EDEDED" class="aa">信息内容</TD>
  <TD width=353 height=23 align=center bgcolor="#EDEDED" class="aa">目前处理情况</TD>
  <TD width=35 height=23 align=center bgcolor="#EDEDED" class="aa">完成情况</TD>
  </TR>  
  <%
dim i,js,str
if not rs.eof then
For I=1 To Rs.PageSize
  If Rs.Eof Then
  Exit For
  End If

 
  %>  
  <TR onclick="javascript:window.open('x_scdb_show.asp?id=<%=rs("id")%>')" style="cursor:hand">
  <TD width=50 height=23 align=center class="aa"><%=rs("bh")%></TD>
  <TD width=93 height=23 align=center class="aa"><%=rs("rq") &" "& rs("tzsj")%></TD>
  <TD width=84 height=23 align=center class="aa"><%=rs("xxly")%></TD>
  <TD width=234 height=23 align=left class="aa"><%=HTMLEncode(rs("xxnr"))%></TD>
  <