请教如何从在asp程序调用EXCEL(数据库是ACCESS)
拜托诸位了!!!
index.asp
-------------------------------------------------
<html>
<head>
<title>Excel</title>
</head>
<body>
<h2 align="center">以下记录是表格中的数据</h2>
<table border="1" width="90%" align="center">
<tr align="center" bgcolor="#E6E6E6">
<td>学号</td><td>姓名</td><td>班级</td><td>电话</td>
</tr>
<%
Dim db,rs,strSql
Set db = Server.CreateObject("ADODB.Connection") '建立Connection对象
db.Open "Driver={Microsoft Excel Driver (*.xls)};Dbq=" & Server.MapPath("Mark.xls")
strSql="Select * From [Sheet1$]" '打开记录集,表名一定要以"[表名$]"的格式
Set rs=db.Execute(strSql)
Do While Not rs.EOF '循环读取所有行
Response.Write "<tr align='center'>"
Response.Write "<td>" & rs("学号") & "</td>"
Response.Write "<td>" & rs("姓名") & "</td>"
Response.Write "<td>" & rs("班级") & "</td>"
Response.Write "<td>" & rs("电话") & "</td>"
rs.MoveNext
Loop
rs.Close '关闭对象
Set rs=nothing
db.Close
Set db=Nothing
%>
</table>
</body>
</html>
-----------------
Mark.xls
sheet1
-----------
学号 姓名 班级 电话