Function Savetotxt(mys)
set fso=Server.CreateObject("Scripting.FileSystemObject")
set f=fso.opentextfile(Server.MapPath("count.txt"),2)
f.writeline mys
f.close
set f=nothing
set fso=nothing
End Function
while not rs.eof
myS="|"&rs.fields("area")
Savetotxt(myS)
rs.movenext
wend
set myfile=server.createobject("scripting.filesystemobject")
set myfiledz=myfile.CreateTextFile(c;\mys.txt,true)
myfiledz.writeline("mys")
myfiledz.close
response.write("你的文件已创建,数据已加入!")
Function WriteToFile
Const ForReading = 1, ForWriting = 2
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
f.Write "Hello world!"
Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)
WriteToFile = f.ReadLine
End Function