星☆空 | 对生活要知足,学习要不知足,为人处事要知不足. 卍 ♂ | ♀ 卐 - 科技以人为本....

QQ:908202921, Msn:btbtd@live.com gI.2288.oRg:88 绿色学院 - GrEeN InsTiTutE, www.btbtd.org

2006-5-22 Asp Access 创建静态文件/HTML By Stabx
标题: 2006-5-22 Asp Access 创建静态文件/HTML By Stabx

正文:

QUOTE:

作用说明:
本代码实现从 Access 提取数据以创建 HTML 文件, 不建文件夹.
如果文件名与要创建的文件名相同, 则覆盖, 跟 SQL 的更新一样的原理.

待加功能: 删除与查找.
shawl.qiu
2006-5-22


CODE:

<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' subject : Asp 创建静态文件/HTML By Stabx
'
' writer : Stabx<shawl.qiu@gmail.com>
'
' blog : http://btbtd.exblog.jp/ ;
'
' blog/site : Phoenix.GI - P.GI / / 绿色学院 - Green Institute
'
' date : 2006-5-22
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select top 10 * from (select top 3500 * from ctarticle order by articleid asc) order by articleid desc" '子查询, 目前被认为比恐龙还恐龙
rs.Open sql, MM_conn_string,1
while not rs.eof '循环创建查询的全部记录为 HTML 文件
cid_=rs("classid")
ncid_=rs("nclassid")
aid_=rs("articleid")
adt_=rs("dateandtime")
tt_=rs("title")
ct_=rs("content")
'em_=htmlToText(rs("email"))
'ht_=rs("hits")
'url_=rs("url")
'src_=rs("www")
'au_=htmlToText(rs("writer"))

response.write "<a href=""" & cid_ & "_"&ncid_&"_"&aid_&".htm"" target=""_blank"">"&cid_ & "_"&ncid_&"_"&aid_& ".htm</a> created at " & now() & "<br>" '链接创建好的文件

cfilename= cid_& "_"&ncid_&"_"&aid_& ".htm" '命名要创建的文件名

set dfso = createobject("scripting.filesystemobject")
Set chtml = dfso.CreateTextFile(server.mappath(cfilename), true)'存在即覆盖
chtml.WriteLine("<html><head>")
chtml.WriteLine("<link rel='stylesheet' type='text/css' href='../css/css_first/ctarticle.css'>")
chtml.WriteLine("<title>"&sitename_&" "&tt_&"</title>")
chtml.WriteLine("</head><body>")
chtml.WriteLine("title: " & tt_& "<p/>" )
chtml.WriteLine("content: " & ct_& "<p/>" )
chtml.WriteLine("created by cid:"&cid_&" ncid:"&ncid_&" aid:"&aid_&"
")
aid_=clng(aid_)
chtml.WriteLine("Page created on: " & now ())
chtml.WriteLine("</body></html>")
chtml.close
rs.movenext
wend
rs.close
set rs=nothing %>
阅读更多
个人分类: MS Access MS ASP
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

2006-5-22 Asp Access 创建静态文件/HTML By Stabx

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭