A more convenient ASP paging program

Source: Internet
Author: User

<span class= "Style45" >
<%
Set Conn=server.createobject ("Adodb.connection")
DBPath = Server.MapPath ("Sap_mis.mdb")
Conn. Open "Driver={microsoft Access driver (*.mdb)};d bq=" & DBPath

Set rs = Server.CreateObject ("Adodb.recordset")
sql = "Select sap_adon_record.* from Sap_adon_record ORDER by s_id Desc"
Rs.Open SQL, Conn, 1, 1
%>
</span>
<table width= "98%" height= "border=" 1 "align=" center "cellpadding=" 0 "cellspacing=" 0 "bordercolor=" #336699 " bordercolordark= "#FFFFFF" class= "Style45" >

<%if Rs. EOF then%>
<tr>
&LT;TD align= "center" ><span style= "color: #339933" ><a href= "add.asp" > System temporarily no record, please click here to add! </a></span>
</td>
</tr>
<%else%>
<tr>
&LT;TD align= "center" bgcolor= "#f000ff" class= "Style45" >111</td>
&LT;TD align= "center" bgcolor= "#f000ff" class= "Style45" >222</td>
&LT;TD align= "center" bgcolor= "#f000ff" class= "Style45" >333</td>
&LT;TD align= "center" bgcolor= "#f000ff" class= "Style45" >444</td>
&LT;TD align= "center" bgcolor= "#f000ff" class= "Style45" >555</td>
&LT;TD align= "center" bgcolor= "#f000ff" class= "Style45" >666</td>
&LT;TD align= "center" bgcolor= "#f000ff" class= "Style45" >777</td>
</tr>
<%
Shownum=20
Totalrecord=rs.recordcount
Rs.pagesize=shownum
Maxpage=rs.pagecount

REQUESTPAGE=CLNG (Request.QueryString ("page"))

If requestpage= "" or requestpage=0 Then
Requestpage=1
End If
If Resquestpage>maxpage Then
Resquestpage=maxpage
End If

If not requestpage=1 then
Rs.move (requestpage-1) *rs.pagesize
End If
For I=1 to Rs.pagesize and not rs.bof%>
<tr>
&LT;TD align= "center" class= "style45" ><a href= ' Show.asp?s_id=<%=rs ("s_id")%> ' target= ' _blank ' ><% =rs ("Prname")%></a></td>
&LT;TD align= "center" class= "Style45" ><%=rs ("Trscod")%></td>
&LT;TD align= "center" class= "Style45" ><%=rs ("Crname")%></td>
&LT;TD align= "center" class= "Style45" ><%=rs ("Crdate")%></td>
&LT;TD align= "center" class= "Style45" ><%=rs ("Prtype")%></td>
&LT;TD align= "center" class= "Style45" ><%=rs ("Fction")%></td>
&LT;TD align= "center" class= "style45" ><a href= ' Edit.asp?s_id=<%=rs ("s_id")%> ' > Edit </a></td >
</tr>
<%
Rs.movenext
If Rs.eof then exit for
Next
%>
</table>
<table width= "98%" height= "align=" "Center" border= "1" bordercolor= "#336699" bordercolordark= "#FFFFFF" cellpadding= "0" cellspacing= "0" >
<tr>
&LT;TD align= "center" class= "Style45" ><a href=add.asp> Add Records </a> |    <a href=readexcel.asp target= "_self" >excel file Bulk Import </a> | <a href=srch.asp> Advanced Query </a>
</td>
</tr>
<tr>
&LT;TD align=center>
<span class= "Style45" >
<%
If requestpage-1 mod 10=0 then
p= (requestpage-1) \ 10
Else
p= (requestpage-1) \ 10
End If
If Requestpage=1 Then
Response.Write "<font face=webdings color=" "#FF0000" ">9</font>"
Else
Response.Write "<a href=index.asp?page=1 title= home ><font face=webdings>9</font></a>"
End If
If P*10>0 then Response.Write "<a href=index.asp?page=" &p*10& "title= 10 pages ><font face=webdings>7 </font></a> "
Response.Write "<b>"
For Ii=p*10+1 to P*10+10
If Ii=requestpage Then
Response.Write "<font color=" "#FF0000" ">" &ii& "</font>"
Else
Response.Write "<a href=index.asp?page=" &ii& ">" &ii& "</a>"
End If
If Ii=maxpage then exit for
Next
Response.Write "</b>"
If Ii<maxpage then Response.Write "<a href=index.asp?page=" &ii& "title= next 10 page ><font face=webdings >8</font></a> "
If Requestpage=maxpage Then
Response.Write "<font face=webdings color=" "#FF0000" ">:</font>"
Else
Response.Write "<a href=index.asp?page=" &maxpage& "title= last ><font face=webdings>:</font> </a> "
End If
Response.Write "A total of" &maxpage& "page Total" &totalrecord& "a record per page" &shownum& "
End If
%>
</span></td>
</tr>
</TABLE>
<span class= "Style45" >
<%
Rs.close
Set rs = Nothing
Conn.close
Set conn = Nothing
%>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.