See code: <% @LANGUAGE = "VBSCRIPT" codepage= "65001"%>
| The code is as follows |
Copy Code |
|
<%
Dim conn,rs,excelfilename
Excelfilename=server.mappath ("Data/test.xls")
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn.connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0; Persist security Info=true;data source= "& Excelfilename &"; Extended properties= "" Excel 8.0; Hdr=yes;imex=1 "";
Conn.Open ()
Set Rs=conn. OpenSchema (20)
%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>excel Operations </title>
<body>
<%
Dim i
Response.Write (Excel table information field: <br/>------------------------<br/> "
for I=0 to rs.fields.count-1 Step 1
Response.Write (Rs.fields (i) .name& "<br/>")
Next
Re Sponse.write (table name in <BR/>excel (table_name): <br/>------------------------<br/> ")
While not Rs. EOF
Response.Write (RS ("table_name") & "<br/>")
rs.movenext
Wend
%>
</ Body>
|