<! -- # Include file = "INC/Conn. asp" -->
<%
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
'-- Create a TXT file
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 "no data"
else
dim strline, responsestr
strline = ""
'-- write the table column name to TXT
for each X in RS. fields
strline = strline & X. name & CHR (9)
next
myfile. writeline strline
do while not Rs. EOF
strline = ""
for each X in RS. fields
strline = strline & X. value & CHR (9)
next
'-- write table data to TXT
myfile. writeline strline
Rs. movenext
loop
end if
Rs. close
set rs = nothing
response. contenttype = "application/X-msdownload"
response. redirect "download.txt"
%>