请高手帮写个asp生成excel的代码

来源:百度知道 编辑:UC知道 时间:2024/06/22 05:00:57
怎么把网站数据库中的某些内容生成excel文件后下载下来,网站用的是asp+access,数据库名为wyxh.asp,文件存放在data文件夹中,要把其中User表中的No,name,adress,class,ip,money,email,QQ,sex这几项导出到excel中的“编号、姓名、地址、班级、IP、金额、email、QQ、性别”的几个项目中,然后下载下来。
哪位高手帮写一下这段asp代码,直接写代码吧,我对asp了解不多,感激不尽!好了再加分。

我写了一个,把所有的数据都导出来了.本来想让你自己研究研究,可是,想想,还是算了.
<%@ LANGUAGE="VBSCRIPT" %>
<%
If Response.IsClientConnected Then
Response.Flush
Else
Response.End
End If
dim conn
dim connstr
dim db
set conn = server.createobject("ADODB.CONNECTION")
db="data/wyxh.asp"
on error resume next
connstr = "Driver={MicroSoft Access Driver (*.mdb)};DBQ="& Server.MapPath(""&db&"") &";

UID=; PWD=;"
'response.write connstr

conn.open connstr
%>
<%
dim oRs,sql
set oRs=Server.CreateObject("ADODB.Recordset")
sql = "select * from User order by id desc"
oRs.open sql,conn,1,1
%>
<%
Response.ContentType = "application/msexcel"
Dim xlWorkSheet
Dim xlApplication
Set xlApplication = Server.CreateObject("Excel.Application")