Asp access creates static files/html

Source: Internet
Author: User

Description:
Ben Code Extract data from access to Create HTML files without creating folders.
If the file name is the same as the file name to be created, it will overwrite it. It is the same principle as SQL updates.

To be added: delete and search. Copy code The Code is as follows: <%
'''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''
'
'Subject: ASP creates a static file/html by stabx
'
'Writer: stabx <shawl.qiu@gmail.com>
'
'Blog: http://btbtd.exblog.jp /;
'
'Blog/Site: Phoenix. Gi-P. gi/\ Green School-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" 'subquery, which is considered to be more dinosaur than a dinosaur
Rs. Open SQL, mm_conn_string, 1
While not Rs. EOF 'all records of loop creation query are HTML files
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> "'link to the created File

Cfilename = CID _ & "_" & NCID _ & "_" & Aid _ & ". htm" 'name the file name to be created

set dfso = Createobject ("scripting. fileSystemObject ")
set chtml = dfso. createtextfile (server. mappath (cfilename), true) 'overwrites
chtml. writeline (" ")
chtml. writeline (" ")
chtml. writeline ("" & sitename _ & "" & TT _ & "")
chtml. writeline (" ")
chtml. writeline ("title:" & TT _ & "

")
chtml. writeline ("content:" & CT _ & "

")
chtml. writeline ("created by CID:" & cid _ & "NCID:" & NCID _ & "aid:" & Aid _ & "
")
Aid _ = clng (Aid _)
chtml. writeline ("page created on:" & now ()
chtml. writeline (" ")
chtml. close
Rs. movenext
Wend
Rs. close
set rs = nothing %>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.