各位高手,怎样在ASP中把数据从数据库中导出到EXCEL中?

henven130 2004-11-26 03:21:13
各位高手,怎样在ASP中把数据从数据库中导出到EXCEL中?
...全文
163 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
gu1dai 2004-11-26
  • 打赏
  • 举报
回复
这个代码是可以运行的。
TSD 2004-11-26
  • 打赏
  • 举报
回复
以前收集了的,你看看能不能用

access导出到excel:

dim rs,sql,filename,fs,myfile,x,link

Set fs = server.CreateObject("scripting.filesystemobject")
filename = "f:\online.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 * from 首页推荐"
rs.Open sql,conn
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
conn.close
set conn = nothing
set myfile = nothing
Set fs=Nothing
meizz 2004-11-26
  • 打赏
  • 举报
回复
你直接把网页另存为 .xls 扩展名的文件, 即可

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧