关闭

asp分页程序及包含替换文件

654人阅读 评论(0) 收藏 举报

 '取得传值变量
on error resume next
pageno=request("pageno")
if pageno="" then
  pageno=1
else
  pageno=cint(request("pageno"))
end if
exec="select * from fagui"
set rs=server.CreateObject("ADODB.recordset")
rs.open exec,cn,3,1
if rs.recordcount=0 then
response.write"没有找到您的记录,请重新查找"
else
rs.pagesize=20
rs.absolutepage=pageno
totalpage=int(rs.recordcount/rs.pagesize)
if rs.recordcount mod rs.pagesize <> 0 then
totalpage=totalpage+1
end if
response.write "<table border=0 width=100% ><tr><td align='center'>"
response.write "共找到<font color='#cc0000'>" & rs.recordcount & "</font>条记录,"
response.write "共<font color='#cc0000'>" & totalpage & "</font>页,"
response.write "这是第<font color='#cc0000'>" & pageno & "</font>页<br><br></td></tr>"
 i=0
do while not rs.eof and i<rs.pagesize
  response.write "<tr><td><img src='image/dian.gif'>&nbsp;<a href=chaxunxiangxi.asp?id=" & rs("id") & " target='_blank' class='title'>" & rs("name") & "</a>"
  response.write "</td></tr>"
  i=i+1
  rs.movenext
loop
response.write"</table>"
'确定分页     
response.write "<table border=0 width=100% >"
response.write"<tr><td align='center'>"
if pageno<>1 then
  response.write"<a href='mguanjianzi.asp?pageno=" & (pageno-1) & "' class='title'><font color='#0000cc'>上一页</font></a>&nbsp;&nbsp;"
  response.write "<a href='mguanjianzi.asp?pageno=1"&"' class='title'><font color='#0000cc'>第一页</font></a>&nbsp;&nbsp;"
end if
 
if pageno<>totalpage then
 response.write"<a href='mguanjianzi.asp?pageno=" & (pageno+1) & "' class='title'><font color='#0000cc'>下一页</font></a>&nbsp;&nbsp;"
 response.write"<a href='mguanjianzi.asp?pageno=" & totalpage & "' class='title'><font color='#0000cc'>最后一页</font></a>"
end if
response.write "</td></tr></table>"
response.write"<table border=0 width=100% ><tr><td align=right>"

rs.close
cn.close
set rs=nothing
set cn=nothing

包含:

<%
application("wt")="Driver={SQL Server};Server=127.0.0.1;Database=114;uid=114;pwd=6088;"
set cn=server.CreateObject("ADODB.Connection")
cn.Open application("wt")
'cn.open"dsn=zczx;uid=;pwd="
'set conn=server.createobject("adodb.connection")
'DBPath = Server.MapPath("/data/db1.mdb")
'cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath

function changechr(str)
  changechr=replace(replace(replace(replace(str,"<","&lt;"),">","&gt;"),chr(13),"<br>")," ","&nbsp;")  
  changechr=replace(replace(replace(replace(changechr,"[img]","<img src="),"[b]","<b>"),"[red]","<font color=CC0000>"),"[big]","<font size=7>")  
  changechr=replace(replace(replace(replace(changechr,"[/img]","></img>"),"[/b]","</b>"),"[/red]","</font>"),"[/big]","</font>")  
end function  

function dealinput(exp1)
dim exp2
exp2=replace(exp1,"<","&lt;")
exp2=replace(exp2,">","&gt;")
exp2=replace(exp2,"'","""")
dealinput=exp2
end function
%>

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:116798次
    • 积分:1470
    • 等级:
    • 排名:千里之外
    • 原创:52篇
    • 转载:20篇
    • 译文:0篇
    • 评论:5条
    文章分类
    最新评论