您当前的位置:天天ASP学习业内动态 → 文章内容

Excel数据检查读取

作者:本站  来源:本站原创  发布时间:2018-01-04 14:30:15
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%response.charset="utf-8"%>
<%session.codepage=65001%>
<%
ExcelFile = "D:\Sites\Site_G\1.xls"
SQL = "SELECT * FROM [Sheet1$]"
connStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&ExcelFile&";Extended Properties='Excel 8.0;HDR=No;IMEX=1';"

Set ExcelConnection = Server.createobject("ADODB.Connection")
ExcelConnection.Open connStr


SET RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, ExcelConnection
Response.Write "<table border=""1""><thead><tr>"
FOR EACH Column IN RS.Fields
	Response.Write "<th>" & Column.Name & "</th>"
NEXT
Response.Write "</tr></thead><tbody>"
IF NOT RS.EOF THEN
	WHILE NOT RS.eof
		Response.Write "<tr>"
		FOR EACH Field IN RS.Fields
			Response.Write "<td>" & trim(Field.value) & "</td>"
		NEXT
		Response.Write "</tr>"
		RS.movenext
	WEND
END IF
Response.Write "</tbody></table>"
RS.close
ExcelConnection.Close
 
			
%>
  • 上一篇文章:FastCGI 进程意外退出造成500错误
  • 下一篇文章:已经没有了
  • 文章评论 (评论内容只代表网友观点,与本站立场无关!)