注册 登录
编程论坛 ASP技术论坛

以excel表为数据库,读出表里的所有内容,谁有这一块的例子,给我一份啊,我参考下

Kettyjin1983 发布于 2008-10-13 16:12, 870 次点击
以excel表为数据库,读出表里的所有内容,谁有这一块的例子,给我一份啊,我参考下.谢谢.
4 回复
#2
Kettyjin19832008-10-14 14:17
顶啊,没人知道吗?
#3
yms1232008-10-14 14:28
Excel.Application方式读取Excel文件的教程
http://blog.
ADODB方式操作Excel文件
http://www.

[[it] 本帖最后由 yms123 于 2008-10-14 14:30 编辑 [/it]]
#4
Kettyjin19832008-10-14 15:16
版主,你真强大.
#5
anlige2008-10-14 20:02
<style>
.eHead {background:#dddddd;border:1px #000000 solid;width:100px;text-align:center;padding:3px auto 1px 3px;}
.eBody {border:1px #eeeeee solid;width:100px;padding:3px auto 1px 3px;}
</style>
<table style="border:0px;border-collapse: collapse;" cellpadding="0" cellspacing="0">
<%
dim ExclePath: ExcelPath=server.mappath("exc.xls")
Dim ExExp :set ExExp=createobject("Excel.Application")
Dim ExWork :Set ExWork = ExExp.Workbooks.Open(ExcelPath) '打开excel表格
Dim ExShem :Set ExShem = ExWork.Sheets(1)  '工作表1

cCount=ExShem.UsedRange.Columns.Count '有效列数
rCount=ExShem.UsedRange.Rows.Count  '有效行数

'输出头(如果你的第1行是表头的话)
response.write "<tr>"
for i=1 to cCount
   response.write "<td class=""eHead"">" & ExShem.Cells(1, i) & "</td>"
next
response.write "</tr>"&vbcrlf

'输出记录
for j=2 to rCount
response.write "<tr>"
   For i = 1 To cCount
       response.write "<td class=""eBody"">" & ExShem.Cells(j, i) & "</td>"
   next
response.write "</tr>"&vbcrlf
Next

ExWork.close() '一定要调用此方法
ExExp.Quit()   '一定要调用此方法
set ExExp=nothing
set ExWork=nothing
set ExShem=nothing
%>
</table>

具体代码看附件吧
只有本站会员才能查看附件,请 登录
1