asp读取excel表名 asp读取excel表名的实现代码

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

asp读取excel表名 asp读取excel表名的实现代码

  2021-03-18 我要评论
想了解asp读取excel表名的实现代码的相关内容吗,在本文为您仔细讲解asp读取excel表名的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点: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)
%>
<!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>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们