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
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
set myfile=server.createobject("scripting.filesystemobject")
set myfiledz=myfile.CreateTextFile(c;\mys.txt,true)
myfiledz.writeline("mys")
myfiledz.close
response.write("你的文件已创建,数据已加入!")
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 Functionwhile not rs.eof
myS="|"&rs.fields("area")
Savetotxt(myS)
rs.movenext
wend我数据库中的表是以下这样:
可为什么我每次查完写入count.txt文件的都不对,
查product_id=1 显示|aa
查product_id=2 显示|xizangdiyu_ID product_id area
1 1 西藏
2 2 cc
3 1 新疆
4 1 aa
5 2 xizang