我的分页功能怎么分不了页?
//运行时只显示第一页,点其它页它不是显示第一页
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="connections/myconn.asp"-->
<%
Dim pg
pg=Trim(Request("page"))
if pg="" then
Pg=1
End if
%>
<%
Dim rs1,numrow_page ,rs1Count
Set rs1=server.createobject("adodb.recordset")
rs1.ActiveConnection=MM_myconn_STRING
rs1.CursorType=3
rs1.LockType=1
numrow_page=5 '每页5条
rs1.Source="select * from treeview"
rs1.PageSize=5 '每页5条记录
rs1.Open()
rs1.AbsolutePage=pg
'rs1Count=rs1.RecordCount
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>无标题文档</title>
</head>
<body>
<table border="1">
<tr>
<td>ID</td>
<td>parentId</td>
<td>nodetext</td>
<td>hint</td>
<td>icon</td>
<td>data</td>
<td>url</td>
<td>target</td>
<td>method</td>
</tr>
<%
numrow_page=0
while (numrow_page<rs1.PageSize) and (not rs1.eof)
%>
<tr>
<td><%=(rs1.Fields.Item("ID").Value)%></td>
<td><%=(rs1.Fields.Item("parentId").Value)%></td>
<td><%=(rs1.Fields.Item("nodetext").Value)%></td>
<td><%=(rs1.Fields.Item("hint").Value)%></td>
<td><%=(rs1.Fields.Item("icon").Value)%></td>
<td><%=(rs1.Fields.Item("data").Value)%></td>
<td><%=(rs1.Fields.Item("url").Value)%></td>
<td><%=(rs1.Fields.Item("target").Value)%></td>
<td><%=(rs1.Fields.Item("method").Value)%></td>
</tr>
<%
numrow_page=numrow_page+1
rs1.movenext
Wend
%>
</table>
<hr size="2" />
<b>Go to Page:</b>
<%
Dim i
if rs1.pagecount>1 then
for i=1 to rs1.pagecount
if i<>cint(pg) then
%>
<a href="test.asp?pg=<%=i%>"><%=i%></a>
<%else %>
<b><%=i%></b>
<%end if
Next
end if
%>
</body>
</html>
|