Excel needs to read Excel payroll with ASP because of work, so I found some information on the Internet.
The following program is written to you:
<%
' =====================asp read Excel notes ===========================
' I "Excel97 or Excel2000 generated xls file (book) as a database, where each worksheet (sheet) as a database table
' II ADO assumes the first behavior field name in Excel. So the scope of your definition must include the first line of content
' III ' the row header (that is, the field name) in Excel cannot contain numbers. Excel drivers can make mistakes when encountering this problem. For example, your row header is named "F1."
' IIII If you have a column in your Excel spreadsheet that contains both text and numbers, then Excel's ODBC driver will not be able to handle this line of data types, you have to ensure that the data type of the column is consistent
' E-mail:kaxue@hotmail.com qq:484110 HOMEPAGE:www.Flyday.net
' Finishing Time: Thursday, May, 2002 5:54 PM WIN2000SERVER+IIS5-Test Pass
'===================================================================
Dim Conn,driver,dbpath,rs
' Create a Connection object
Set Conn = Server.CreateObject ("ADODB. Connection ")
Driver = "Driver={microsoft Excel Driver (*.xls)};"
DBPath = "dbq=" & Server.MapPath ("Test.xls")
' Invoke the Open method to open the database
Conn.Open Driver & DBPath
' DSN connection method
' Conn.Open ' dsn=test '
' Note that the table name must be written in the "[Table name $]" below.
Sql= "SELECT * from [sheet1$] where serial number = 0"
Set Rs=conn.execute (SQL)
IF rs.eof and Rs.bof Then
Response.Write "did not find the data you need!!"
Else
Do as not rs.eof
Response.Write Rs ("name")
Rs.movenext
Loop
End IF
Rs.close
Set rs=nothing
Conn.close
Set conn=nothing
' Response.Write ' Success! "
%>