asp通用分页函数

 

 1 < % dim  rs3,pm3,bg
 2 page = clng (request( " page " ))
 3 set  rs3  =  server. createobject ( " adodb.recordset " )
 4 sql3  =   " select distinct brlword from userinfo where bfenshuduan=' " & key & " ' order by brlword"
 5 rs3.open sql3,conn, 1 , 1
 6 if  rs3.eof  then
 7 % >
 8      < tr >
 9        < td width = " 580 "  colspan = " 5 " >
10      < p align = " center " >< font color = " #FF0000 " > 对不起,没有符合条件的高校! </ font >
11
12        </ td >
13      </ tr >
14      < tr >
15       < td width = " 580 "  colspan = " 5 " >
16 < else  % >
17 < %
18 const  maxperpage = 1
19 dim  currentpage
20 rs3.pagesize = maxperpage
21 currentpage = request.querystring( " pageid " )
22 if  currentpage = ""   then
23 currentpage = 1
24 elseif  currentpage < 1   then
25 currentpage = 1
26 else
27 currentpage = clng (currentpage)
28      if  currentpage  >  rs3.pagecount  then
29     currentpage = rs3.pagecount
30      end   if
31 end   if
32
33 if   not   isnumeric (currentpage)  or  currentpage = ""   then
34 currentpage = 1
35 end   if
36 dim  totalput,n
37 totalput = rs3.recordcount
38 if  totalput  mod  maxperpage = 0   then
39 n = totalput \ maxperpage
40 else
41 n = totalput \ maxperpage + 1
42 end   if
43 if  n = 0   then
44 n = 1
45 end   if
46 rs3.move(currentpage - 1 ) * maxperpage
47 i = 0
48 do   while  i <  maxperpage  and   not  rs3.eof
49         % >
50          < tr >
51          < td >< % = getschoolinfo(rs3( " brlword " ), 1 )% ></ td >
52          < td >< % = getschoolinfo(rs3( " brlword " ), 2 )% ></ td >
53          < td >< % = getschoolinfo(rs3( " brlword " ), 5 )% ></ td >
54          < td >< % = getschoolinfo(rs3( " brlword " ), 3 )% ></ td >
55          < td >< % = getschoolinfo(rs3( " brlword " ), 4 )% ></ td >
56        </ tr >
57 < %                                                                         
58 i = i + 1                                                       
59 rs3.movenext                                                        
60 loop                                                                                  
61                                     
62 % >    
63      </ table >
64 < p align = " center " > 页数: < % = currentpage% >/< = n% >                                                        
65         < %k = currentpage                                                                                
66         if  k <> 1   then % >                                                             
67         < a href = " picitop2.asp?pageid=1 " > 首页 </ a >                                                                                 
68         < a href = " picitop2.asp?pageid=<%=k-1%>&key=<%=key%> " > 上一 </ a >                                                                                 
69         < % else % >                                                             
70        首页 上一页                                                                                
71         < % end   if % >                                                             
72         < % if  k <> then % >                                                                                 
73         < a href = " picitop2.asp?pageid=<%=k+1%>&key=<%=key%> " > 下一 </ a >                                                                                 
74         < a href = " picitop2.asp?pageid=<%=n%>&key=<%=key%> " > 尾页 </ a >                                                                                 
75         < % else % >                                                             
76        下一页 尾页                                                                                
77         < % end   if % >                                                             
78      共为您找到 < font color = " red " >< % = totalput% ></ font > 所高校
79  

你可能感兴趣的:(asp)