dim xwzlr()
n=0
for i = 1 to len(icontent)
zh =mid(icontent,i,1)
xzh=server.htmlencode(zh) '使字符不支持html语法
redim preserve xwzlr(n)
xwzlr(n)=lrtemp '使add.html中表单form中textarea一行一行分别存在数组中
if asc(xzh)=10 then
n=n+1
lrtemp=""
redim preserve xwzlr(n)
end if
lrtemp = lrtemp + zh
next
'连接数据库
set dbconn=server.createobject("adodb.connection")
conpath="DBQ=" &server.mappath("wzozg.mdb")
dbconn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & conpath
'新增文章
iozg="wz-"
sql="INSERT INTO ozg(wsubject,wname,wcount,wdate,wauth,wsource) Values
('"&isubject&"','"&iozg&"',0,'"&sj&"','"&iauth&"','"&isource&"')"
dbconn.Execute(sql)
sql="update ozg set wname='wz-'&cstr(wid)&'.asp' " '若文章id=n (n=0,1,2,...),则使 存放文章内容的文本文件
名为 "wz-n.asp",即id号与文本文件名唯一对应
dbconn.Execute(sql)
sql="select wcontent from ozg "
set rs=server.createobject("adodb.recordset")
rs.open sql,dbconn,3,1
rs.movelast
iozg=rs("wcontent") '获取文本文件名"wz-n.asp"
rs.close
dbconn.Close
thisfile = server.mappath(iozg)
Set fs=Server.CreateObject("scripting.FileSystemObject")
Set outfile = fs.CreateTextFile(thisfile) '创立文本文件"wz-n.asp" (n=0,1,2,...)
for i=0 to n step 1
outfile.WriteLine xwzlr(i) '把数组中的文章内容逐行写入文本文件"wz-n.asp"中
next
outfile.close
set fs=nothing
%>
---------------------------------------------------
writen by aspboy and powered by http://easp.126.com