ASP 把数据库内容生成Word文档保存到目录下

Posted on 2009-11-18 19:01  严武  阅读(327)  评论(0编辑  收藏  举报

Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.ActiveConnection = MM_conn_STRING
rs1.Source = "SELECT * FROM dbo.LabIntroduce ORDER BY ID DESC"
rs1.CursorType = 0
rs1.CursorLocation = 2
rs1.LockType = 1
rs1.Open()

rs1_numRows = 0


 Dim fso, MyFile      
    Set fso = CreateObject("Scripting.FileSystemObject")     '用到fso        
    sFileName = ".doc"      
    Set MyFile = fso.CreateTextFile(Server.MapPath(""&rs1("AdminName")&"") &sFileName,   True)   '文件放在当前目录的word/下  
    myString=""&rs1("AdminText")&""  
    MyFile.WriteLine(myString)  
    MyFile.Close
 

rs1.Close()
Set rs1 = Nothing 

Copyright © 2024 严武
Powered by .NET 9.0 on Kubernetes