回复 2楼 yms123
程序代码:
<%@ language="jscript" codepage="936" %>
<table border="1">
<%
var connXls = Server.CreateObject("ADODB.Connection");
connXls.Open("Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\tab.xls");
var rs = connXls.Execute("SELECT * FROM [工作薄$]");
Response.Write("<tr>");
for (var e = new Enumerator(rs.Fields); !e.atEnd(); e.moveNext()) {
var field = e.item();
Response.Write("<th>" + field.Name + "</th>");
}
Response.Write("</tr>");
while (!rs.EOF) {
Response.Write("<tr>");
for (var e = new Enumerator(rs.Fields); !e.atEnd(); e.moveNext()) {
Response.Write("<td>" + e.item().Value + "</td>");
}
Response.Write("</tr>");
rs.MoveNext();
}
rs.Close();
connXls.Close();
%>
</table>