Set conn=Server.CreateObject("ADODB.Connection")
StrConn="Driver={Microsoft Excel Driver (*.xls)};DriverId=790; DBQ="& realpath
conn.Open StrConn
Set rs = Server.CreateObject("ADODB.Recordset")
Sql="select * from [Sheet1$]"
rs.Open Sql,conn,2,2
set Columns=rs.Fields
ColCount=Columns.Count '获得字段数
do while Not rs.EOF
'预留判断
rs(0)
rs(1)
rs(2)
或者
set objConn=Server.CreateObject("ADODB.Connection")
set objRS=Server.CreateObject("ADODB.Recordset")
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" & server.mappath
("test.xls")
更多信息请查看IT技术专栏