如何直接调用EXCEL数据
类别: ASP教程
<%@language=vbscript %>
<%
Set exlApp = server.CreateObject("Excel.Application")
strsource = "e:excelsample.xls"
\' 数据库位置
Set exlstock = exlApp.Workstocks.Open(strsource)
Set exlsheet = exlstock.Worksheets(1)
i=1
response.write "<table cellpadding=0 cellspacing=0 border=1 width=500>"
while exlsheet.cells(i,1)<>""
response.write "<tr>"
response.write " <td height=20 align=center width=100>" & xlsheet.Cells(i, 1) & "</td>"
response.write " <td height=20 align=center width=200>" & xlsheet.Cells(i, 2) & "</td>"
response.write " <td height=20 align=center width=200>" & xlsheet.Cells(i, 3) & "</td>"
response.write "</tr>"
i=i+1
wend
response.write "</table>"
set xlsheet=nothing
set xlstock=nothing
xlApp.quit
%>
<%
Set exlApp = server.CreateObject("Excel.Application")
strsource = "e:excelsample.xls"
\' 数据库位置
Set exlstock = exlApp.Workstocks.Open(strsource)
Set exlsheet = exlstock.Worksheets(1)
i=1
response.write "<table cellpadding=0 cellspacing=0 border=1 width=500>"
while exlsheet.cells(i,1)<>""
response.write "<tr>"
response.write " <td height=20 align=center width=100>" & xlsheet.Cells(i, 1) & "</td>"
response.write " <td height=20 align=center width=200>" & xlsheet.Cells(i, 2) & "</td>"
response.write " <td height=20 align=center width=200>" & xlsheet.Cells(i, 3) & "</td>"
response.write "</tr>"
i=i+1
wend
response.write "</table>"
set xlsheet=nothing
set xlstock=nothing
xlApp.quit
%>
- 上一篇: ASP+中文显示之两种解决方法
- 下一篇: VBS类生成XML文件
-= 资 源 教 程 =-
文 章 搜 索