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条)