ASP生成html文件

<%
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open "select top 30 * from data order by a desc",conn,1,1
while not rs.eof
Dim Str
str =""
str = str&"<html xmlns=""http://www.w3.org/1999/xhtml"">"&VbCrLf
str = str&"<head>"&VbCrLf
str = str&"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"" />"&VbCrLf
str = str&"<title>"&left(rs("test"),20)&"-许愿网,爱情许愿树,2536.com</title>"&VbCrLf
str = str&"<meta name=""keywords"" content='"&rs("class")&"' />"&VbCrLf
str = str&"<meta name=""description"" content='"&rs("test")&"' />"&VbCrLf
str = str&"</head>"&VbCrLf
str = str&"<body>"&VbCrLf

str = str&"要生成的内容"&VbCrLf

str = str&"</body>"&VbCrLf
str = str&"</html> "&VbCrLf

Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
 .Open
 .Charset = "gb2312"
 .Position = objStream.Size
 .WriteText = Str
 .SaveToFile Server.MapPath("要生成的文件名.htm"),2
 .Close
End With
Set objStream = Nothing
rs.movenext   
wend
rs.close   
set rs=Nothing 
%>

原载: http://www.auuo.com
版权说明:原创文章欢迎转载,但转载请务必以超链接标明文章原始出处、作者信息和本声明。否则必追究法律责任。

联系我们

QQ:51193930(Ahoo)
MSN:auuocx@hotmail.com
网址:http://www.auuo.com
地址:慈溪天九商务中心525室
电话:189-0662-0882

我们的优势
拥有优秀的网站设计师与程序工程师,精通各种一流的图形设计软件,如Photoshop、Freehand CorlDraw、Flash、Dreamweaver、Fireworks等等制作网页和平面设计图。以及使用C语言、C#、ASP.NET框架、asp、php等语言为您开发项目,我们为您准备了最专业的技术服务。为您开发的网站精致实用,代码清晰,保证您的网站安全可靠修改方便,最重要的是符合市场需求,并随时为客户解决各种技术问题。

我们正在努力开拓...

baidu

互联网 本网站