ASP生成Html文件分页问题!

2013 年 1 月 8 日5900

<%
db="wwxxg_GSdreaming_2250507.mdb" '请修改数据库路径
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
Set fso=Server.CreateObject("Scripting.FileSystemObject") '// 打开网页模板文件,读取模板内容
Set htmlwrite=fso.OpenTextFile(Server.MapPath("2.html"))
strOut=htmlwrite.ReadAll
htmlwrite.close
sql="select * from Admin_lanmu"
set rs=server.createObject("ADODB.Recordset")
rs.open sql,conn,1,1
rs.pagesize=5
totalpage=rs.pagecount
rs.close
set rs=nothing
for i=1 to totalpage
Lname=""
sql="select * from Admin_lanmu"
set rs=server.createObject("ADODB.Recordset")
rs.open sql,conn,1,1
whichpage=i
rs.pagesize=5
totalpage=rs.pagecount
rs.absolutepage=whichpage
howmanyrecs=0
do while not rs.eof and howmanyrecs<rs.pagesize
Lname=Lname&Rs("Lname")&"&nbsp;|&nbsp;"
rs.movenext
howmanyrecs=howmanyrecs+1
loop
rs.close
set rs=nothing
title="ASP生成Html页面的分页方法!"
StrOut=Replace(StrOut,"{title}",title)
StrOut=Replace(StrOut,"{Lname}",Lname)
Set htmlwrite=fso.CreateTextFile(Server.MapPath("wangwei_"&i&".html"),true) '// 写入网页内容
htmlwrite.WriteLine strOut
htmlwrite.close
Response.Write "查看Lname的内容:"&i&","&Lname&"<br><br>"
Response.Write "正在生成第"&i&"个页面!<br><br>"
next
%>


0 0