国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - ASP教程 - asp分頁的一個類

asp分頁的一個類

2019-10-21 10:18asp教程網 ASP教程

asp分頁的一個類,在50,000條記錄下測試過,速度比ado的那個要快多了

asp分頁的一個類,在50,000條記錄下測試過,速度比ado的那個要快多了

  1. <%  
  2.  
  3. '************************************************************************************  
  4. '具體用法  
  5. Dim strDbPath  
  6. Dim connstr  
  7. Dim mp  
  8. Set mp = New MyPage  
  9. strDbPath = "fenye/db.mdb"  
  10. connstr  = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="  
  11. connstr  = connstr & Server.MapPath(strDbPath)  
  12. Set conn  = Server.CreateObject("Adodb.Connection")  
  13. conn.open connstr  
  14. set rs = mp.Execute("select * from table1",conn,29)  
  15. while not rs.eof  
  16.     response.write rs("aaaa")&"<br>"  
  17.     rs.MoveNext  
  18. wend  
  19. mp.pageDispaly()  
  20. '************************************************************************************  
  21. Class MyPage  
  22.     private MyPage_Conn,MyPage_StrSql,MyPage_TotalStrSql,MyPage_RS,MyPage_TotalRS  
  23.     private MyPage_PageSize  
  24.     private MyPage_PageAbsolute,MyPage_PageTotal,MyPage_RecordTotal  
  25.     private MyPage_Url  
  26.     public property let conn(strConn)  
  27.     set MyPage_Conn = strConn  
  28.     end property  
  29.  
  30.     public property let PageSize(intPageSize)  
  31.         MyPage_PageSize = Cint(intPageSize)  
  32.     end property  
  33.  
  34.     public function PageExecute(strSql)  
  35.         MyPage_PageAbsolute = MyPage_PageAbsoluteRequest()  
  36.         MyPage_TotalStrSql = FormatMyPage_TotalStrSql(strSql)   
  37.         set MyPage_TotalRS = MyPage_Conn.execute(MyPage_TotalStrSql)  
  38.         MyPage_RecordTotal = MyPage_TotalRS("total")  
  39.         MyPage_PageTotal = Cint(MyPage_RecordTotal/MyPage_PageSize)  
  40.         MyPage_StrSql = FormatMyPage_StrSql(strSql)  
  41.         set MyPage_RS = MyPage_Conn.execute(MyPage_StrSql)  
  42.         dim i  
  43.         i = 0   
  44.         while not MyPage_RS.eof and  i<(MyPage_PageAbsolute-1)*MyPage_PageSize  
  45.             i = i + 1  
  46.             MyPage_RS.MoveNext  
  47.         wend  
  48.         set PageExecute = MyPage_RS   
  49.     end function  
  50.  
  51.     public function Execute(strSql,strConn,intPageSize)  
  52.         conn = strConn  
  53.         PageSize = intPageSize  
  54.         set Execute = PageExecute(strSql)  
  55.     end function  
  56.  
  57.     public function pageDispaly()  
  58.         MyPage_Url = ReadMyPage_Url  
  59.         firstPageTag = "<font face=webdings>9</font>"  '|<<  
  60.         LastPageTag = "<font face=webdings>:</font>"  '>>|  
  61.         previewPageTag = "<font face=webdings>7</font>"  '<<  
  62.         nextPageTag = "<font face=webdings>8</font>"  '>>  
  63.         dim strAnd  
  64.         if instr(MyPage_Url,"?")=0 then  
  65.             strAnd = "?"  
  66.         else  
  67.             strAnd = "&"  
  68.         end if  
  69.         response.write "<table width=100%  border=0 cellspacing=0 cellpadding=0>"  
  70.         response.write "<tr>"  
  71.         response.write "<td align=left>"  
  72.         response.write  "頁次:"&MyPage_PageAbsolute&"/"&MyPage_PageTotal&"頁 "  
  73.         response.write  "主題數:"&MyPage_RecordTotal  
  74.         response.write "</td>"  
  75.         response.write "<td align=right>"  
  76.         response.write  "分頁:"  
  77.         if MyPage_PageAbsolute>10 then  
  78.             response.write  "<a href='"&MyPage_Url&strAnd&"MyPage_PageNo=1'>"&firstPageTag&"</a>"  
  79.             response.write  "<a href='"&MyPage_Url&strAnd&"MyPage_PageNo="&(MyPage_PageAbsolute-10)&"'>"&previewPageTag&"</a>"  
  80.         else  
  81.             response.write  firstPageTag  
  82.             response.write  previewPageTag  
  83.         end if  
  84.         response.write " "  
  85.         dim CurrentStartPage,i  
  86.         i = 1  
  87.         CurrentStartPage=(Cint(MyPage_PageAbsolute)\10)*10+1  
  88.         if Cint(MyPage_PageAbsolute) mod 10=0 then  
  89.             CurrentStartPage = CurrentStartPage - 10  
  90.         end if  
  91.         while i<11 and CurrentStartPage<MyPage_PageTotal+1  
  92.             if CurrentStartPage < 10 then  
  93.                 FormatCurrentStartPage = "0" & CurrentStartPage  
  94.             else  
  95.                 FormatCurrentStartPage = CurrentStartPage  
  96.             end if  
  97.             response.write  "<a href='"&MyPage_Url&strAnd&"MyPage_PageNo="&CurrentStartPage&"'>"&FormatCurrentStartPage&"</a> "  
  98.             i = i + 1  
  99.             CurrentStartPage = CurrentStartPage + 1  
  100.         wend  
  101.         if MyPage_PageAbsolute<(MyPage_PageTotal-10) then  
  102.             response.write  "<a href='"&MyPage_Url&strAnd&"MyPage_PageNo="&(MyPage_PageAbsolute+10)&"'>"&nextPageTag&"</a>"  
  103.             response.write  "<a href='"&MyPage_Url&strAnd&"MyPage_PageNo="&MyPage_PageTotal&"'>"&LastPageTag&"</a>"  
  104.         else  
  105.             response.write  nextPageTag  
  106.             response.write  LastPageTag  
  107.         end if  
  108.         response.write  ""  
  109.         response.write "</td>"  
  110.         response.write "</tr>"   
  111.         response.write "</table>"  
  112.     end function  
  113.  
  114.     public function GetPageNo()  
  115.         GetPageNo = cint(MyPage_PageAbsolute)  
  116.     end function  
  117.  
  118.     public function GetPageCount()  
  119.         GetPageCount = cint(MyPage_PageTotal)  
  120.     end function  
  121.  
  122.     public function GetPageNoName()  
  123.         GetPageNoName = "MyPage_PageNo"  
  124.     end function  
  125.  
  126.     public function GetPageSize()  
  127.         GetPageSize = MyPage_PageSize  
  128.     end function  
  129.  
  130.     public function GetRecordTotal()  
  131.         GetRecordTotal = MyPage_RecordTotal  
  132.     end function  
  133.  
  134.       
  135.  
  136.     private function FormatMyPage_TotalStrSql(strSql)  
  137.         FormatMyPage_TotalStrSql = "select count(*) as total "  
  138.         FormatMyPage_TotalStrSql = FormatMyPage_TotalStrSql & Mid(strSql,instr(strSql,"from"))  
  139.         FormatMyPage_TotalStrSql = Mid(FormatMyPage_TotalStrSql,1,instr(FormatMyPage_TotalStrSql&"order by","order by")-1)  
  140.     end function  
  141.  
  142.     private function FormatMyPage_StrSql(strSql)  
  143.         FormatMyPage_StrSql = replace(strSql,"select","select top "&(MyPage_PageAbsolute*Cint(MyPage_PageSize)))  
  144.     end function  
  145.  
  146.     private function MyPage_PageAbsoluteRequest()  
  147.         if request("MyPage_PageNo")="" then   
  148.             MyPage_PageAbsoluteRequest = 1  
  149.         else  
  150.             if IsNumeric(request("MyPage_PageNo")) then  
  151.                 MyPage_PageAbsoluteRequest = request("MyPage_PageNo")  
  152.             else  
  153.                 MyPage_PageAbsoluteRequest = 1  
  154.             end if  
  155.         end if  
  156.     end function  
  157.  
  158.     private function ReadMyPage_Url()  
  159.         ReadMyPage_Url = Request.ServerVariables("URL")  
  160.         if Request.QueryString<>"" then  
  161.             ReadMyPage_Url = ReadMyPage_Url & "?" & Request.QueryString   
  162.         end if  
  163.         set re = new RegExp  
  164.         re.Pattern = "[&|?]MyPage_PageNo=\d+?"  
  165.         re.IgnoreCase = true  
  166.         re.multiLine = true  
  167.         re.global = true  
  168.         Set Matches = re.Execute(ReadMyPage_Url)   
  169.         For Each Match in Matches    
  170.             tmpMatch = Match.Value  
  171.             ReadMyPage_Url = replace(ReadMyPage_Url,tmpMatch,"")  
  172.         next  
  173.     end function  
  174. end Class  
  175.  
  176. %>  

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 亚洲精品无码专区在线播放 | 日韩中文字幕视频 | 91亚洲精品乱码久久久久久蜜桃 | 欧美视频一区二区 | 欧美一级久久久 | 在线国产一区二区 | 成年女人在线观看 | 国产999精品久久久影片官网 | 成人av在线网 | 欧美日韩一区二区视频在线观看 | 亚洲国产免费 | 久久久av亚洲男天堂 | 欧美日韩a | 亚洲精品乱码久久久久久久久 | 亚洲一区视频在线 | 人人99 | 久久久国产精品入口麻豆 | 成年人在线看 | 亚洲人免费视频 | 日韩精品免费在线观看 | 艹久久 | 国内精品一区二区三区 | 在线免费观看激情视频 | 中国大陆一级毛片 | 性色国产| 亚洲成人一区二区三区 | 91在线网 | 日韩一二三区视频 | 99在线精品视频 | 欧美综合婷婷 | 特级毛片在线 | 羞羞视频在线看 | 亚洲国产精品久久久久婷婷老年 | 亚洲色视频 | 亚洲精品国产成人 | 激情久久av一区av二区av三区 | 91.成人天堂一区 | 黄在线免费观看 | 麻豆国产尤物av尤物在线观看 | 午夜在线影院 | 日本在线播放 |