当前位置: 移动技术网 > IT编程>开发语言>Asp > asp读取excel表名的实现代码

asp读取excel表名的实现代码

2017年12月08日  | 移动技术网IT编程  | 我要评论
看代码:
复制代码 代码如下:

<%@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)
%>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" " http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<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
response.write(rs.fields(i).name&"<br />")
next
response.write("<br />excel中的表名(table_name):<br />------------------------<br />")
while not rs.eof
response.write(rs("table_name")&"<br />")
rs.movenext
wend
%>
</body>
</html>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网