dim rs,sql,filename,fso,myfile,x
Set fso = server.CreateObject("scripting.filesystemobject")
filename = Server.MapPath ("download.txt")
if fso.FileExists(filename) then
fso.DeleteFile(filename)
end if
'--创建txt文件
set myfile = fso.CreateTextFile (filename,true)
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from userfile"
rs.Open sql,conn,1,1
if rs.EOF and rs.BOF then
response.write "無数据"
else
dim strLine,responsestr
strLine=""
'-- 表の列名先写入txt
rs.fieldsの各x
strLine = strLine & x.name & chr(9)
次へ
myfile.writeline strLine
Do while Not rs.EOF
strLine=""
rs.Fields の各 x について
strLine = strLine & x.value & chr(9)
next
'-- 表的データ写入txt
myfile.writeline strLine
rs.MoveNext
loop
end if
rs.Close
set rs = nothing
Response.ContentType="application/x-msdownload"
Response .リダイレクト「download.txt」
%>