国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > JS > 正文

用ASP將SQL搜索出來(lái)的內(nèi)容導(dǎo)出為TXT的代碼

2024-09-06 12:41:56
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
<!--#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 
'--創(chuàng)建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 "無(wú)數(shù)據(jù)" 
else 
dim strLine,responsestr 
strLine="" 
'--將表的列名先寫入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 
'--將表的數(shù)據(jù)寫入txt 
myfile.writeline strLine 
rs.MoveNext 
loop 
end if 
rs.Close 
set rs = nothing 
Response.ContentType="application/x-msdownload" 
Response.Redirect "download.txt" 
%>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 荥经县| 西乡县| 彰武县| 潮安县| 丹阳市| 沂南县| 会东县| 镇雄县| 凤庆县| 定州市| 谷城县| 奉贤区| 大冶市| 灵寿县| 怀宁县| 广元市| 宜丰县| 新津县| 醴陵市| 泰和县| 平定县| 长治县| 潜江市| 安平县| 若尔盖县| 邵阳市| 肃北| 晋宁县| 开封市| 曲阳县| 三门县| 筠连县| 普安县| 城固县| 重庆市| 尉氏县| 舒兰市| 酒泉市| 阿鲁科尔沁旗| 乌拉特前旗| 丰顺县|