asp记录集分页显示

来源:百度知道 编辑:UC知道 时间:2024/06/11 11:11:48
Dim oConn, oRs, sSql
Set oConn = Server.CreateObject("ADODB.Connection")
On Error Resume Next
' Access数据库
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db.mdb")
Set oRs = Server.CreateObject( "ADODB.Recordset" )
sSql = "SELECT * FROM NewsData ORDER BY D_ID DESC"
oRs.Open sSql, oConn, 1, 1

要求对内容
<li>
<%If oRs("D_Picture") <> "" Then%>
<img width=20 height=10 border=1 src="<%=oRs("D_Picture")%>">
<%End If%>
<a href="show1.asp?id=<%=oRs("d_id")%>"><%=outHTML(oRs("d_title"))%></a>
分页显示.....如图...

<!--#include file = "NewsSystem/st.asp"-->
<%
dim pre,last,page,intpage,i

Set oRs = Server.CreateObject( "ADODB.Recordset" )
sSql = "SELECT * FROM NewsData ORDER BY D_ID DESC"

oRs.PageSize = 30 '这里设定每页显示的记录数
oRs.CursorLocation = 3
oRs.Open sSql,oConn,0,2,1 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))

if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= oRs.PageCount then
intpage = oRs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not oRs.eof then
oRs.AbsolutePage = intpage
end if
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "谁帮下我asp分页显示记录 ASP高手请进-分页显示记录 asp 控制分页显示记录数问题 ASP记录集分页的问题 ASP中记录集如何分页 asp分页程序却为什么显示了全部记录? 有关asp分页分列显示记录的问题 关于ASP分页显示 asp分页显示问题? asp 分页显示问题