Asp tutorial access large data volume paging method this section page effects Support paging, paging effect: Home Page previous... 234567... next page last page this paging mode with Forum style idtitlecontentstatusupdatetime1t1c112010-5-2621: 16: 062t2c212010-5-2621: 16: 093t3c312010
Asp tutorial access the paging method of big data volume 'pagination effect of this Section supports 'pagination, pagination effect: homepage Previous Page... 2 3 4 5 6 7... the paging mode of the last page of the next page includes the Forum style 'idtitlecontentstatusupdatetime' 1t1c112010-5-26 21:16:06 '2t2c212010-5-26 21:16:09' 3t3c312010
Asp tutorial access largeDataThe number of pagesMethod
'Pagination effect supports 'pagination. pagination effect: homepage Previous Page... 2 3 4 5 6 7... This pagination mode has a forum style.
'Id title content status updatetime
'1 t1 c1 1 2010-5-26 21:16:06
'2 t2 c2 1 2010-5-26 21:16:09
'3 t3 c3 1 21:16:12
'4 t4 c4 1 21:16:15
'5 t5 c5 1 21:16:23
DB = "database/db1.mdb"
Path = Server. MapPath (DB)
Set conn = server. createobject ("adodb. Connection ")
Connstr = "provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & path
Conn. Open connstr
Set rs = server. CreateObject ("adodb. recordset ")
%>
New Document
Data
Method
ID |
Title |
Time |
<%'10 billion or moreOf'Author: wangsdong'Source: 111cn.net'The original file, reprinted please keep this information, thank youKeyword = request ("keyword ")Page = request ("page ")If page = "" Or Not IsNumeric (page) then page = 1 Else page = CInt (page)Page_size = 2Q1 = "and status> 0"If keyword <> "Enter the keyword" and keyword <> "" thenQ1 = q1 & "and title like '%" & keyword & "% '"End IfIf page> 1 thenSQL = "select top" & page_size & "id, title, content, updatetime from news where 1 = 1 and id <(select min (id) from (select top "& (page-1) * page_size &" id from news where status> 0 "& q1 &" order by id desc) as c1 )"ElseSQL = "select top" & page_size & "id, title, content, updatetime from news where 1 = 1"End ifSQL = SQL & q1 & "order by id desc"Set rs = server. CreateObject ("adodb. recordset ")Rs. open SQL, conn, 1, 1If not rs. eof thenDo while not rs. eofId = rs ("id ")Title = rs ("title ")Content = rs ("content ")Updatetime = rs ("updatetime ")********************** **%>
<% = Id %> |
<% = Title %> |
<% = Updatetime %> |
<%********************** **Rs. movenextLoopEnd ifRs. close%>
<% 'Start by pagination 'Calculate the total number of pages Page_count = 1 SQL = "select count (*) as t from news where 1 = 1" & q1 Rs. open SQL, conn, 1, 1 If rs. eof then Else Recordset_count = rs ("t ") If recordset_count mod page_size = 0 then Page_count = recordset_countpage_size Else Page_count = recordset_countpage_size + 1 End if End if Rs. close 'Pagination, pagination effect: homepage Previous Page... 2 3 4 5 6 7... Next page last page If page = 1 then Response. write "homepage previous" Else Response. write "homepage previous" End if If page> 4 then S = page-3 Response. write "..." Else S = 1 End if If page <= page_count-3 then E = page + 3 Else E = page_count End if For I = s to e If I = page then Response. write""& I &"" Else Response. write "" & I &"" End if NextIf page Response. write "..." End if If page = CInt (page_count) then Response. write "the last page of the next page" Else Response. write "the last page of the next page" End if %> |