类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
调用
<%
Dim Conn,Rs_News
Set Conn = server.CreateObject("ADODB.CONNECTION")
Conn.Open "cpm","cpm","cpm"
Dim Sql
Sql = "Select * from erche"
Set Rs_News = Server.CreateObject("ADODB.RECORDSET")
Rs_News.Open Sql,Conn,1,3
%>
<!--#include file=admin/inc/TurnPage.asp-->
<%
Dim RowCount
RowCount = 10
Call TurnPage(Rs_News,RowCount)
%>
<table width=100%>
<tr>
<td>新闻编号</td>
<td>新闻标题</td>
<td>发布日期</td>
<tr>
<%
If Not Rs_News.eof
Do while Not Rs_News.eof and RowCount>0
%>
<tr>
<td><%=Rs_News("advertisetitle")%></td>
<td><%=Rs_News("wareprice")%></td>
<td><%=Rs_News("time1")%></td>
<tr>
<%
RowCount = RowCount - 1
Rs_News.MoveNext
Loop
End If
%>
公共分页模块
<%
Sub TurnPage(ByRef Rs_tmp,PageSize)
Dim TotalPage
Dim PageNo
Dim RecordCount
Rs_tmp.PageSize = PageSize
RecordCount = Rs_tmp.RecordCount
TotalPage = INT(RecordCount / PageSize * -1)*-1
PageNo = Request.QueryString ("PageNo")
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
If PageNo = "" then PageNo = 1
If RecordCount <> 0 then
Rs_tmp.AbsolutePage = PageNo
End If
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
fileName = Mid(fileName,postion)
%>
<table border=0 width=100%>
<tr>
<td align=left> 总页数:<font color=#ff3333><%=TotalPage%></font>页
当前第<font color=#ff3333><%=PageNo%></font>页</td>
<td align="right">
<%If RecordCount = 0 or TotalPage = 1 Then
Response.Write "首页|前页|后页|末页"
Else%>
<a href="<%=fileName%>?PageNo=1">首页|</a>
<%If PageNo - 1 = 0 Then
Response.Write "前页|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo-1%>">前页|</a>
<%End If
If PageNo+1 > TotalPage Then
Response.Write "后页|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo+1%>">后页|</a>
<%End If%>
<a href="<%=fileName%>?PageNo=<%=TotalPage%>">末页</a>
<%End If%></td>
<td width=95>转到第
<%If TotalPage = 1 Then%>
<input type=text name=PageNo size=3 readonly disabled style="background:#d3d3d3">
<%Else%>
<input type=text name=PageNo size=3 value="" title=请输入页号,然后回车>
<%End If%>页
</td>
</tr>
</table>
<%End Sub%>
提示错误
错误类型:
Microsoft VBScript 编译器错误 (0x800A03F9)
/2s/fanhuid.asp, 第 28 行, 第 18 列
If Not Rs_News.eof
-----------------^
我改了好几次觉得不是这错了,高手指点.
网友回答:
If Not Rs_News.eof then