This article describes how ASP reads data from Excel tables, excel2007 supports SQL queries to read data, and Excel can be used as a database.
The following code after my test is available for everyone to refer to.
The code is as follows:
<% ' reads the x row y column set Conn=server.createobject ("ADODB. Connection ") Set Rs=server.createobject (" ADODB. Recordset ") strconn=" Provider=Microsoft.Jet.OLEDB.4.0;Data source= "+server.mappath (" 1.xls ") +"; Extended properties= ' Excel 8.0; Hdr=no;imex=1 ' "Conn.Open strconnfunction getxy (table,x,y) sql=" SELECT * FROM ["&table&" $] "Rs. Open sql,conn,1,1if not rs.eof then Rs.move x-1 getxy=rs (y-1) elsegetxy= "" End IFRS. Closeconn.closeset rs = NothingSet Conn = nothingend functionresponse.write getxy ("Civil marriage Registration", 3,4)%>
I am provided by topic.alibabacloud.com, I am topic.alibabacloud.com author "Ty80".
Article Address: http://www.php.cn/csharp-article-377119.html
Learn programming to topic.alibabacloud.com www.php.cn