Asp Access 創(chuàng)建靜態(tài)文件/HTML
更新時(shí)間:2006年10月13日 00:00:00 作者:
作用說明:
本代碼實(shí)現(xiàn)從 Access 提取數(shù)據(jù)以創(chuàng)建 HTML 文件, 不建文件夾.
如果文件名與要?jiǎng)?chuàng)建的文件名相同, 則覆蓋, 跟 SQL 的更新一樣的原理.
待加功能: 刪除與查找.
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' subject : Asp 創(chuàng)建靜態(tài)文件/HTML By Stabx
'
' writer : Stabx<shawl.qiu@gmail.com>
'
' blog : http://btbtd.exblog.jp/ ;
'
' blog/site : Phoenix.GI - P.GI / \ 綠色學(xué)院 - 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" '子查詢, 目前被認(rèn)為比恐龍還恐龍
rs.Open sql, MM_conn_string,1
while not rs.eof '循環(huán)創(chuàng)建查詢的全部記錄為 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>" '鏈接創(chuàng)建好的文件
cfilename= cid_& "_"&ncid_&"_"&aid_& ".htm" '命名要?jiǎng)?chuàng)建的文件名
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 %>
本代碼實(shí)現(xiàn)從 Access 提取數(shù)據(jù)以創(chuàng)建 HTML 文件, 不建文件夾.
如果文件名與要?jiǎng)?chuàng)建的文件名相同, 則覆蓋, 跟 SQL 的更新一樣的原理.
待加功能: 刪除與查找.
復(fù)制代碼 代碼如下:
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' subject : Asp 創(chuàng)建靜態(tài)文件/HTML By Stabx
'
' writer : Stabx<shawl.qiu@gmail.com>
'
' blog : http://btbtd.exblog.jp/ ;
'
' blog/site : Phoenix.GI - P.GI / \ 綠色學(xué)院 - 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" '子查詢, 目前被認(rèn)為比恐龍還恐龍
rs.Open sql, MM_conn_string,1
while not rs.eof '循環(huán)創(chuàng)建查詢的全部記錄為 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>" '鏈接創(chuàng)建好的文件
cfilename= cid_& "_"&ncid_&"_"&aid_& ".htm" '命名要?jiǎng)?chuàng)建的文件名
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 %>
相關(guān)文章
通過MSXML2自動(dòng)獲取QQ個(gè)人頭像及在線情況(給初學(xué)者)
通過MSXML2自動(dòng)獲取QQ個(gè)人頭像及在線情況(給初學(xué)者)...2007-03-03ASP模仿google suggest風(fēng)格實(shí)現(xiàn)下拉菜單效果
這篇文章主要介紹了ASP模仿google suggest風(fēng)格實(shí)現(xiàn)下拉菜單效果,需要的朋友可以參考下2015-09-09asp 數(shù)組 重復(fù)刪除函數(shù)(腳本之家增強(qiáng)版)
這篇文章是asp下刪除重復(fù)數(shù)組的函數(shù),已經(jīng)經(jīng)過測試。2010-05-05asp取動(dòng)態(tài)表單中數(shù)據(jù)并寫入xml文件,用xsl顯示
asp取動(dòng)態(tài)表單中數(shù)據(jù)并寫入xml文件,用xsl顯示...2006-09-09