ASP生成html问题(100分求教)

来源:百度知道 编辑:UC知道 时间:2024/06/28 01:33:48
下面是我编写的ASP生成HTML的代码,系统提示生成成功,却没有生成文件。

("clssname")是分类数据,输入clssname生成这个分类里的所有文章的HTML文件。
("newsid")是文章的编号,也是生成文件的文件名
<%
clssname=request("clssname")
set rs=server.createobject("adodb.recordset")
Set rs = conn.Execute("select * from news where online=true and clssname ='&clssname&'")
newsid=rs("newsid")
rs.close
dim fso
dim fr
dim wstr
dim fw
set fso=createobject("scripting.filesystemobject")
set fr=fso.opentextfile(server.mappath("html\news.htm"))
Set rsprod = conn.Execute("select * from news where Online=true and newsid='"&newsid&"'")

Prodname=rsprod("name")
prodkey=rsprod("key")
wstr=fr.readall
wstr=replace(wstr,"<{{name}}>",name)
wstr=replace(wstr,"<{{key}}>",key)

set fw=fso.cre

set fso=createobject("scripting.filesystemobject")
set fr=fso.opentextfile(server.mappath("html\news.htm"),1)
wstr=fr.readall
fr.close '资源关闭和释放
set fr=nothing

Set rsprod = conn.Execute("select * from news where Online=true and newsid='"&newsid&"'")

Prodname=rsprod("name")
prodkey=rsprod("key")
'如果需要用到循环这里 wstr做模板数据
wstr1=replace(wstr,"<{{name}}>",Prodname) '这里不是name
wstr1=replace(wstr1,"<{{key}}>",prodkey) '这里不是key

set fw=fso.createtextfile(server.mappath("html/" & newsId & ".htm"),true)
fw.write(wstr1) '这里是wstr1
fw.close
set fso=nothing
response.write "ok"

if SaveFile("/new<%=id%>.html","http://127.0.0.1/newss.asp?id=