最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
将指定的记录生成excel文件
时间:2022-07-02 23:03:33 编辑:袖梨 来源:一聚教程网
<%
DB="db1.mdb"
path=Server.MapPath(DB)
set conn=server.createobject("adodb.Connection")
connstr="provider=Microsoft.Jet.OLEDB.4.0;Data Source="&path
conn.Open connstr
Set rs=server.CreateObject("adodb.recordset")
%>
1.asp文件
<%
'功能:将指定的记录生成excel文件
'作者:wangsdong
id=request("id")
set Conn =server.CreateObject("adodb.connection")
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open ConnStr
dim rs,sql,filename,fs,myfile,x
Set fs = server.CreateObject("scripting.filesystemobject")
filename = Server.MapPath("111cn.net教程.xls")
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
set myfile = fs.CreateTextFile(filename,true)
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select id,username,password,content,sex,ytime from users where id in("&id&")"
rs.Open sql,conn,1,1
if rs.EOF and rs.BOF then
else
dim strLine,responsestr
strLine=""
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
myfile.writeline strLine
rs.MoveNext
loop
end if
rs.Close
set rs = nothing
Response.Write "生成EXCEL文件成功!下载:javascript教程:window.open('aspprogra.xls')"">"
%>
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22