fso实例(2)


else
pencat=replace(pencat,"Fname",zznews)
end if
pencat=replace(pencat,"H_Title",title)
pencat=replace(pencat,"H_Memo",content)
pencat=replace(pencat,"labout",about)
pencat=replace(pencat,"ftitle",ftitle)

newsdate = year(now()) & "." & month(now()) & "." & day(now())
TimePath = year(Now()) & "-" & month(now()) & "-" & day(Now())
FolderPath = Server.MapPath(".")& "\" & TimePath



rs.close
'将新闻保存入数据库

sql="select * from article where (newsid is null)"

rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("content")=content
rs("Nfrom")=from
rs("typeid")=typeid
rs("path")=TimePath
rs("typename")=typename
rs("tjnews")=tjnews
rs("N_Fname")=fname
rs("zznews")=zznews
rs("about")=about
rs("newsdate")=newsdate
rs("yheadline")=yheadline
rs("headline")=headline
if ftitle <> "" then rs("ftitle")=ftitle
rs.update

pencat=replace(pencat,"h_id",rs("newsid"))

Set fso = Server.CreateObject("Scripting.FileSystemObject")
If CheckDir(FolderPath) = True Then
Set fout = fso.CreateTextFile(FolderPath & "\" & fname)
Else
MakeNewsDir TimePath
Set fout = fso.CreateTextFile(FolderPath & "\" & fname)
End if
fout.WriteLine pencat
fout.close

articleid=rs("newsid")
UpdateJs(news)
rs1.close
set rs1=nothing
rs.close
set rs=nothing
conn.close
set conn=nothing
response.redirect "addnews.asp"
%>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2979.html