asp数据库成excel文件代码

asp数据库成excel文件代码


2024年6月21日发(作者:)

asp数据库数据生成excel文件:

生成EXCEL文件实例

在线生成EXCEL


<%

if Request("act") = "" then

"生成EXCEL文件实例"

else

dim conn,strconn

strconn="driver={SQL Server};server=wen;uid=sa;pwd=;database=DB_Test"

set conn=Object("tion")

strconn

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

Set fs = Object("stemobject")

'--假设你想让生成的EXCEL文件做如下的存放

filename = h("")

'--如果原来的EXCEL文件存在的话就删除

if ists(filename) then

File(filename)

end if

'--创建EXCEL文件

set myfile = TextFile(filename,true)

Set rs = Object("set")

'--从数据库中把你想放到EXCEL中的数据读出来

sql = "select * from Tb_Execl order by id desc"

sql,conn,1,1

if and then

else

dim strLine,responsestr

strLine=""

For each x in

strLine = strLine & & chr(9)

Next

'--将表的列名先写入EXCEL

ine strLine

Do while Not

strLine=""

for each x in

strLine = strLine & & chr(9)

next

'--将表的数据写入EXCEL

ine strLine

xt

loop

end if

set rs = nothing

End If

%>

以上信息更具具体情况修改


发布者:admin,转转请注明出处:http://www.yc00.com/news/1718941647a2753734.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信