我在數據庫中做了一個叫做TEST1的表,
我想實現這個表中的內容能分頁顯示,以下是代碼:
pop.asp代碼:
<!--#include file="adovbs.inc"-->
<!--#include file="show.asp"-->
<%
IF NOT IsObject(Session("TEST_cn")) THEN
Set cn=Server.CreateObject("ADODB.Connection")
cn.Provider="sqloledb"
ProvStr="Server=DAVID;Database=TEST;UID=test;PWD=test;"
cn.Open ProvStr
Set Session("TEST_cn")=cn
ELSE
Set cn=Session("TEST_cn")
END IF
IF NOT IsObject(Session("TEST1_rs")) THEN
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "Select * from test1",cn,adOpenStatic
Set Session("TEST1_rs")
ELSE
Set rs=Session("TEST1_rs")
END IF
%>
<HTML><head><title>信息瀏覽</title></head>
<body>
<%
rs.PageSize=5
Page=CLng(Request("PageText"))
IF Page<1 THEN Page=1
IF page>rs.PageCount THEN Page=rs.PageCount
ShowPage rs,Page
%>
<div align=center><form action="pop.asp" method="get">
<%
IF Page<>1 THEN
Response.Write"<a href=pop.asp?PageText=1 target=pa>第一頁</a>"
Response.Write"<a href=pop.asp?PageText="&(Page-1)&"target=pa>上一頁</a>"
END IF
IF Page<>rs.PageCount THEN
Response.Write"<a href=pop.asp?PageText="&(Page+1)&"target=pa></a>"
Response.Write"<a href=pop.asp?PageText="&rs.PageCount&"target=pa>最後一頁</a>"
END IF
%>
<P>輸入頁號:<input type=text name="PageText" size=3>
總頁數:<font color="RED"><%=Page%>/<%rs.PageCount%></font></p>
</form></div></body></html>
show.asp代碼:
<%
Sub ShowPage(rs,Page)
Response.Write"<center><table border=1>"
Response.Write"<tr bgcolor=#ddeeff>"
FOR i=0 TO rs.Fields.Count-1
Response.Write"<td>"&rs.Fields(i).Name&"</td>"
NEXT
Response.Write"</tr>"
Response.Write Page
rs.AbsolutePage=Page
FOR i=1 TO rs.PageSize
Response.Write"<tr>"
FOR j=0 TO rs.Fields.Count-1
Response.Write"<td>"&rs.Fields(j).Value&"</td>"
NEXT
Response.Write"</tr>"
rs.MoveNext
IF rs.EOF THEN Exit FOR
END IF
Response.Write"</table></center>"
End Sub
%>
現在出現如下錯誤:
錯 誤 碼:0x800A0400
錯誤代碼:END IF
錯誤描述:必須提供陳述式
檔案名稱:d:\web\4\show.asp
所在行號:19
請問是什麼問題.......
asp中的分頁問題