主题:  初学者需要一简单原码《分页显示数据库内容》

icerain

职务:普通成员
等级:1
金币:1.0
发贴:249
#12003/7/8 23:02:46
各位朋友谁有分页显示数据的ASP原码给我贴上来好吗

要简单的

功能如下
每页显示十条 有上一页 下一页 显示所有页数的下拉框 最后一页 最前一页

OK 就这些了 麻烦各位帮我一下喽~~~



icerain

职务:普通成员
等级:1
金币:1.0
发贴:249
#22003/7/9 22:59:11
为什么没有人帮我啊



爱多媒体爱生活

职务:普通成员
等级:2
金币:1.0
发贴:303
#32003/7/12 22:47:46
自己搜一下吧~~



mantou_5d

职务:普通成员
等级:3
金币:1.0
发贴:437
#42003/7/14 21:34:00
我以前作的,今天翻出来了,和你的要求不大一样,自己改吧!
www.mantou001.com

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>


<%
Dim Recordset1__MMColParam
If (Request.QueryString("lanmuid") <> "") Then
Recordset1__MMColParam = Request.QueryString("lanmuid")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_article_STRING
Recordset1.Source = "SELECT * FROM article WHERE lanmuid = " + Replace(Recordset1__MMColParam, "'", "''") + " ORDER BY id DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("lanmuid") <> "") Then
Recordset2__MMColParam = Request.QueryString("lanmuid")
End If
%>
<%
Dim Recordset2
Dim Recordset2_numRows

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_article_STRING
Recordset2.Source = "SELECT * FROM lanmu WHERE lanmuid = " + Replace(Recordset2__MMColParam, "'", "''") + ""
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()

Recordset2_numRows = 0
%>
<%
Dim Recordset4__MMColParam
Recordset4__MMColParam = "4"
If (Request("MM_Emptyvalue") <> "") Then
Recordset4__MMColParam = Request("MM_Emptyvalue")
End If
%>
<%
Dim Recordset4
Dim Recordset4_numRows

Set Recordset4 = Server.CreateObject("ADODB.Recordset")
Recordset4.ActiveConnection = MM_readcount_STRING
Recordset4.Source = "SELECT * FROM readcounter WHERE id = " + Replace(Recordset4__MMColParam, "'", "''") + ""
Recordset4.CursorType = 0
Recordset4.CursorLocation = 2
Recordset4.LockType = 1
Recordset4.Open()

Recordset4_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 20
dim MM_size
MM_size=Repeat1__numRows
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>


馒头网-<%=(Recordset2.Fields.Item("lanmu").value)%>





<%
Dim Recordset1_total
Recordset1_total = Recordset1.RecordCount
While (Not Recordset1.EOF)
Recordset1_total = Recordset1_total + 1
Recordset1.MoveNext
Wend
%>








    您现在的位置→馒头网/<%=(Recordset2.Fields.Item("lanmu").value)%>/<%=(Recordset4.Fields.Item("pagereadcounter").value)%>人访问      一共有<%=Recordset1_total+1%>篇文章









<%
    dim mantoutotal
    dim mantoui
    mantoutotal = Recordset1_total
    Recordset1_total = Recordset1.RecordCount
    Recordset1.MoveFirst()
    if request.QueryString("offset")<>"" Then
    for mantoui=0 to request.QueryString("offset")*2-1
     Recordset1.MoveNext()
     mantoui=mantoui+1
    next
    end if
%>



<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>

<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>




◆ &keyzi=<%=(Recordset1.Fields.Item("keyzi").value)%>"><%=(Recordset1.Fields.Item("title").value)%>  <%=(Recordset1.Fields.Item("time").value)%>
跳转到<
<%
dim pici
for pici=MM_size to mantoutotal+MM_size step MM_size
%>
&offset=<%if (pici-MM_size)=0 then response.Write("-1") else response.Write(pici-MM_size)%>"><%=pici/MM_size%>
<%next%>
>页

 






<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
<%
Recordset4.Close()
Set Recordset4 = Nothing
%>