麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

ASP分頁函數、分頁導航

2019-11-17 04:13:09
字體:
來源:轉載
供稿:網友
程序代碼
<%
'//分頁函數
    '//psize:每頁顯示的數據數
    '//pindex:當前頁碼
    '//tbName:表名
    '//keyIndex:根據什么字段分頁,一般是自增長類型(access數據庫的自動編號)
    '//where:查詢條件
    '//order:排序條件,缺省為" order by " &keyIndex &" desc"
    '//總記錄數與總頁數可從返回的結果集中直接獲取,字段datacount存儲總記錄數,字段pagecount存儲總頁數
    PRivate pindex,datacount,pages
    'datacount = 0
    'pages = 1
    public function changePage(psize,tbName,keyIndex,where,order)
        dim sqlstring
        pindex = Trim(Request.QueryString("page"))
        if not isnumeric(psize) or psize="" then psize=1'//每頁顯示的數據數
        if not isnumeric(pindex) or pindex="" then pindex=1'//當前頁碼
        if order="" then order=" order by " & keyIndex & " desc"
        '//獲取總數據數
        'dim datacount,pages
        set rs=conn.execute("select count(*) as datacount from " & tbName & " where 1=1 " & where)
        datacount = rs("datacount")'//總記錄數
        rs.close
        set rs=nothing
        '//計算總頁數
        if (datacount mod psize)=0 then
            pages=datacount / psize
        else
            pages=datacount / psize + 1
        end if
        '//
        if cint(pindex)>pages then pindex=pages
        '拼接sql字符串
        if pindex<=1 then
            sqlstring="select top " & psize & " *," & datacount & " as datacount," & pages & " as pagecount from " &_
                        tbName & " where 1=1 " & where & " " & order
        else
            sqlstring="select top " & psize & " *," & datacount & " as datacount," & pages & " as pagecount from " &_
                        tbName & " where 1=1 and " & keyIndex & " not in(select top " & (pindex-1)*psize & " " & keyIndex & " from " &_
                        tbName & " where 1=1 " & where & " " & order & ") " & where & " " & order
        end if
        'Response.Write(sqlstring)
        set changePage=conn.execute(sqlstring)
    end function
    '//分頁導航
    '//fileName:文件名/當前頁面的話,可以留空
    '//argString:分頁參數例如classid=1&tid=16,分頁必須的參數page不必填寫
    '//pindex:當前頁碼
    '//datacount:總記錄數
    '//pages:總頁數
    '//showMsg:是否顯示分頁信息,參數為true/false
    '//showText:是否顯示首頁、上頁、下頁、末頁的導航,參數為true/false
    '//showNumber:是否顯示數字分頁導航,參數為true/false
    'public function pageLink(fileName,argString,pindex,datacount,pages,showMsg,showText,showNumber)
    public function pageLink(fileName,argString,showMsg,showText,showNumber)
        '//
        if argString<>"" then argString = argString & "&"
        if not showText and not showNumber then showText=true
        '//
        if showMsg then
            Response.Write("[")
            Response.Write("第 <span style='color:red;'>" & pindex & "</span> 頁")
            Response.Write("/分 <span style='color:red;'>" & pages & "</span> 頁")
            Response.Write("/總 <span style='color:red;'>" & datacount & "</span> 條記錄")
            Response.Write("] ")
        end if
        '//
        if showText then
            if pindex>1 then
                Response.Write("<a href='" & fileName & "?" & argString & "page=1'>[首頁]</a>")
                Response.Write(" ")
                Response.Write("<a href='" & fileName & "?" & argString & "page=" & pindex - 1 & "'>[上頁]</a>")
            else
                Response.Write("[首頁]")
                Response.Write(" ")
                Response.Write("[上頁]")
            end if
            Response.Write(" ")
            if pindex<pages then
                Response.Write("<a href='" & fileName & "?" & argString & "page=" & pindex + 1 & "'>[下頁]</a>")
                Response.Write(" ")
                Response.Write("<a href='" & fileName & "?" & argString & "page=" & pages & "'>[末頁]</a>")
            else
                Response.Write("[下頁]")
                Response.Write(" ")
                Response.Write("[末頁]")
            end if
        end if
        '//
        if showNumber then
            Response.Write("      ")
            for i = 4 to 1 step -1
                if (pindex - i)>0 then
                    Response.Write("<a href='" & fileName & "?" & argString & "page=" & pindex - i & "'>" & pindex - i & "</a>")
                    Response.Write(" ")
                end if
            next
            '//
            Response.Write("<span style='color:red;'>" & pindex & "</span>")
            '//
            for i = 1 to 4
                if (pindex + i)<=pages then
                    Response.Write(" ")
                    Response.Write("<a href='" & fileName & "?" & argString & "page=" & pindex + i & "'>" & pindex + i & "</a>")
                end if
            next
            '//
        end if
        '//
    end function
%>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 天天操天天碰 | 特级黄色影院 | av在线播放电影 | 欧美精品成人一区二区三区四区 | 韩国精品视频在线观看 | 中国免费一级毛片 | 在线亚洲免费 | vidz 98hd | 极品美女一级毛片 | 羞羞的动漫在线观看 | 日韩视频一二区 | 久久久一区二区精品 | 久久久久91视频 | 日本xxxx视频 | 欧美性生活网站 | 日韩视频一区二区三区四区 | 国产成人午夜精品 | 久久综合婷婷香五月 | 欧美精品成人一区二区在线观看 | 偷偷草网站| 日韩欧美激情视频 | 欧美日本亚洲视频 | www.69色 | 欧美一级做a| 精品视频一区二区三区四区 | 日韩精品久久久久久久电影99爱 | 黄色毛片一级视频 | 久久精品在线免费观看 | 精国品产一区二区三区有限公司 | 国产成人综合在线观看 | 国产精品视频亚洲 | 国内精品久久久久久久星辰影视 | 性少妇videosexfreexx入片 | 在线观看免费av网 | 国产一区精品在线观看 | 亚洲男人的天堂在线视频 | 国产精品视频二区不卡 | 久久久www成人免费毛片 | 污片在线观看视频 | 亚洲精品a级 | 日本不卡二区 |