用代码将access中的数据生成Excel表格导出

用代码将access中的数据生成Excel表格导出


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

用代码将access中的数据生成Excel表格导出。

下面为代码:

以下为引用的内容:

<%

if session("china_admin")="" then ct ""

dbpath="../"

dblink

dim filename,fs,myfile,x,m,n,o,link

Set fs = Object("stemobject")

Set rs = Object("set")

session("sql") = "select * from china_car"

session("sql"),conn,1,1

n=1

'=================================================

=================

'=================================================

=============建立excel文件系统

filename = h("car/CarTable"&n&".xls") '这个是为了方便,新建一

个CAR的文件夹,这个可以自己设啦

if ists(filename) then'如果文件存在,覆盖它。

File(filename)

end if

set myfile = TextFile(filename,true)

'=================================================

=======================

dim strLine,responsestr

strLine=""

dim work,j,i

str="序号|卡号|密码|积分数|金额" '这个根据你的access数据表字段设置。

work=split(str,"|")

j=ubound(work)

i=0

o=0

do while not i>j

strLine= strLine & work(i) & chr(9)

i=i+1

loop

ine strLine

Do while Not

o=o+1

m=20000

strLine=""

for each x in

strLine= strLine & & chr(9)

if o>=m*n then

n=n+1

filename = h("car/CarTable"&n&".xls") '这个可以自己设啦

if ists(filename) then'如果文件存在,覆盖它。

File(filename)

end if

set myfile = TextFile(filename,true)

end if

next

ine strLine

xt

loop

set rs = nothing

set conn = nothing

set myfile = nothing

Set fs=Nothing

ExcelPath="car/CarTable"&n&".xls"

"导出成功 "

("

d>下载")


发布者:admin,转转请注明出处:http://www.yc00.com/web/1718938924a2753703.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信