Recommended: Asp file operation function set % '==================================================== ' Compiled by: Zhang Hui' Programmer code: WJ008' Compiled time: June 1, 2008' Follow address: www.wj008.net ' All file addresses used by all functions use absolute addresses'======================================================================================================================================================
<%@ language = vbscript codepage = 936%>
<%
option explicit 'Compulsory definition of variables
dim idcount'Total number of records
dim pages'Number of per page
dim pagec'Total number of pages
dim page' page number
dim pagenc 'The number of page numbers displayed per page = pagenc*2+1
pagenc=2
dim pagenmax 'Maximum page number of pages displayed per page
dim pagenmin 'The minimum page number of pages displayed per page
page=clng(request(page))
dim start' time of program start
dim endt' time of ending program
dim datafrom'datatable name
datafrom=table1
dim conn,rs
dim datapath 'database pass
dim sqlid' id required for this page
dim myself'Address of this page
myself = request.servervariables(path_info)
dim sql'sql statement
dim taxis' sort statement
'taxis=order by id asc 'Positive sort
taxis=order by id desc 'Inverted sort
dim i' integer used for loop
start=timer()
datapath=db.mdb' database
pages=30
'Connection to open the database
dim db
db=db.mdb 'Define the database path and name
set conn = server.createobject(adodb.connection)
conn.open provider=microsoft.jet.oledb.4.0;data source= & server.mappath(db)
if err.number <> 0 then
Response.write Database link error!
response.end()
end if
'Get the total number of records
sql=select count(id) as idcount from [& datafrom &]
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,0,1
idcount=rs(idcount)'get the total number of records
if(idcount>0) then'If the total number of records = 0, it will not be processed
if(idcount mod pages=0)then'If the total number of records is divided by the remaining number of each page, then = the total number of records/number of each page + 1
pagec=int(idcount/pages)'get the total number of pages
else
pagec=int(idcount/pages)+1'Get the total number of pages
end if
'Get the id needed for this page===========================================================
'Read all records' id values, because there is only id so the speed is very fast
sql=select id from [& datafrom &] & taxis
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,1,1
rs.pagesize = pages 'Number of records displayed per page
if page < 1 then page = 1
if page > pagec then page = pagec
if pagec > 0 then rs.absolutepage = page
for i=1 to rs.pagesize
if rs.eof then exit for
if(i=1)then
sqlid=rs(id)
else
sqlid=sqlid &,&rs(id)
end if
rs.movenext
next
'End of id required to obtain this page===============================================================
end if
%>
<!doctype html public -//w3c//dtd html 4.01 transitional//en>
<html>
<head>
<meta http-equiv=content-type content=text/html; charset=gb2312>
<title>Quick paging</title>
<link rel=stylesheet href=page.css type=text/css>
</head>
<body bgcolor=#f2f2f2 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<table width=100% height=100% border=0 cellpadding=20 cellpacing=0>
<tr>
<td valign=middle><table width=100% height=100% border=0 cellpadding=0 cellpacing=1 bgcolor=#cccccc>
<tr>
<td valign=top bgcolor=#ffffff><br> <table width=90% border=0 align=center cellpading=0 cellpacing=0 class=zw>
<tr>
<td><strong><font color=#ff6600>Quick paging</font></strong></td>
</tr>
</table>
<br>
<table width=90% border=0 align=center cellpadding=3 cellpacing=1 bgcolor=cccccccc class=zw>
<tr align=center bgcolor=#9fcb07>
<td width=9%><strong>ID</strong></td>
<td width=37%><strong>Theme</strong></td>
<td width=33%><strong>Content</strong></td>
<td width=21%><strong>Time</strong></td>
</tr>
<%
if(idcount>0 and sqlid<>) then'If the total number of records = 0, it will not be processed
'Use in to select the data in the language of this page, and only read the data required for this page, so the speed is fast
sql=select [id],[aaaa],[bbbb],[cccc] from [& datafrom &] where id in(& sqlid &) &taxis
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,0,1
while(not rs.eof)'Fill data into table
%>
<tr bgcolor=#ffffff>
<td align=center><%=rs(0)%></td>
<td><%=rs(1)%></td>
<td><%=rs(2)%></td>
<td align=center><%=rs(3)%></td>
</tr>
<%
rs.movenext
wend
%>
</table>
<br>
<table width=90% border=0 align=center cellpadding=2 cellpacing=0 class=zw>
<tr align=center>
<td align=left>There are a total of <strong><font color=#ff6600><%=idcount%></font></strong> records, <strong><font color=#ff6600><%=page%></font></strong>/<%=pagec%>, and each page is <strong><font color=#ff6600><%=pages%></font></strong> records. </td>
</tr>
</table>
<table width=90% border=0 align=center cellpadding=2 cellpacing=0 class=zw>
<tr align=center>
<td align=right>
<%
'Set the page number to start ============================================
pagenmin=page-pagenc' Calculate the page number start value
pagenmax=page+pagenc' Calculate the end value of page number
if(pagenmin<1) then'If the page number start value is less than 1 then = 1
pagenmin=1
end if
if(page>1) then'If the page number is greater than 1, it will be displayed (first page)
response.write (<a href='& myself &?page=1'><font color='#000000'>Page 1</font></a>)
end if
if(pagenmin>1) then'If the page number start value is greater than 1, it will be displayed (update)
response.write (<a href='& myself &?page=& page-(pagenc*2+1) &'><font color='#000000'>Advance</font></a>)
end if
if(pagenmax>pagec) then'If the end value of the page number is greater than the total number of pages, then = total number of pages
pagenmax=pagec
end if
for i = pagenmin to pagenmax' loop output page number
if(i=page) then
response.write (<font color='#ff6600'><strong>& i &</strong></font>)
else
response.write ([<a href=& myself &?page=& i &><font color='#000000'>& i &</font></a>])
end if
next
if(pagenmax<pagec) then'If the end value of the page number is less than the total number of pages, it will be displayed (afterwards)
response.write (<a href='& myself &?page=& page+(pagenc*2+1) &'><font color='#000000'>after</font></a>)
end if
if(page<pagec) then' If the page number is less than the total number of pages, it will be displayed (last page)
response.write (<a href='& myself &?page=& pagec &'><font color='#000000'>Last page</font></a>)
end if
'Set the page number to end ==============================================
%><script language=javascript>
<!--
function gopage() {
window.location.href=<%=myself%>?page=+ page.value;
}
//-->
</script>
Go to
<input name=page type=text value=<%=page%> size=5> page
<input type=button name=submit value=jump></td>
</tr>
</table>
<%
end if
%>
<br>
<table width=90% border=0 align=center cellpadding=2 cellpacing=0 class=zw>
<tr>
<td align=center>
<p>
<%
endt=timer()
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%=formatnumber((endt-start)*1000,3)%>ms</p>
<p> <a href= http://stone-stone.vip.sina.com/ target=_blank>STONE space</a></p></td>
</tr>
</table>
<br></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
Share: ASP's setup tips for using FCKEditor 1. Open the fckconfig.js file in the default language (relative to the FCKeditor folder, the same below), change the automatic detection language to non-detection, and change the default language to Simplified Chinese: Program code FCKConfig.AutoDetectLanguage = false ; FCKConfig.DefaultLanguage = 'zh-cn' ; 2. Open the fckconfig.js file in the font list, in the font list