有没有办法使用 FileSystemObject 将查询输出写入文本文件?
What's the format of the query results? you may be able to do something like this if it's a simple string, or you may have to extract the bits that you need.
Here's the code to write a string to a text file using the filesystemobject:
Const fsoForAppend = 8
Dim objFSO
Dim queryResult
queryResult = 'OMG no results'
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Open the text file
Dim objTextStream
Set objTextStream = objFSO.OpenTextFile("C:\path\to\logfile.txt", fsoForAppend)
'Write the results to the textfile
objTextStream.WriteLine queryResult
'Close the file and clean up
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.