Home > Backend Development > C#.Net Tutorial > asp reads the value of row x and column y of excel table

asp reads the value of row x and column y of excel table

PHP中文网
Release: 2017-08-19 13:21:30
Original
2275 people have browsed it

This article introduces how asp reads data in excel tables. Excel2007 supports sql query to read data. Excel can be regarded as a database.

The following code has been tested by me and is available for your reference.

The code is as follows:

<%
&#39;读取x行y列
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=&#39;Excel 8.0;HDR=no;IMEX=1&#39;"
Conn.Open strConn
function getxy(table,x,y)
sql="SELECT * FROM ["&table&"$]"
rs.Open sql,Conn,1,1
if not rs.eof then 
rs.move x-1 
getxy=rs(y-1)
else
getxy=""
end if
rs.Close
Conn.Close
set rs = Nothing
set Conn = Nothing
end function
response.write getxy("民政婚姻登记",3,4)
%>
Copy after login

I am provided by PHP Chinese website. I am "Ty80", the author of PHP Chinese website.

Article address: //m.sbmmt.com/csharp-article-377119.html

Come to PHP Chinese website to learn programming m.sbmmt.com

The above is the detailed content of asp reads the value of row x and column y of excel table. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template