asp读取excel表名的实现代码

2018-09-06 13:16

阅读:553

  看代码:
复制代码 代码如下:
<%@LANGUAGE=VBSCRIPT CODEPAGE=65001%>
<%
dim conn,rs,excelFileName
excelFileName=Server.MapPath(Data/test.xls)
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
<html xmlns=
<head>
<meta http-equiv=Content-Type content=text/html; charset=utf-8 />
<title>Excel操作</title>
</head>

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


评论


亲,登录后才可以留言!