asp读取excel表名的实现代码

看代码:
复制代码 代码如下:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
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)
%>




Excel操作



<%
dim i
response.write("Excel表信息字段:
------------------------
")
for i=0 to rs.fields.count-1 step 1
response.write(rs.fields(i).name&"
")
next
response.write("
Excel中的表名(Table_Name):
------------------------
")
while not rs.EOF
response.write(rs("Table_Name")&"
")
rs.movenext
wend
%>


你可能感兴趣的:(asp读取excel表名的实现代码)