This work is done by ASP operation Excel, the whole program is marked out every line, and then like to do in the blank. Now I've changed it. Dynamically displays the items for each row, and then displays the row by line, and finally makes a summary.
1, FSO find Excel file
<%
Dim fso,folder,file
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(Server.MapPath("data"))
Dim name
For Each file in folder.Files
name = fso.GetBaseName(file)
%>
<li><%=name%></li>
<%
Next
%>
2, connect the Excel file, get the name of the first sheet
<%
Create a Connection object
Set CONN_QC = Server.CreateObject ("ADODB. Connection ")
Driver = "Provider=Microsoft.Jet.OLEDB.4.0;"
Dbparm = "Extended properties=" "Excel 8.0; Hdr=yes;imex=1 "";
To open a database by calling the Open method
DBPath = "Data source=" & Server.MapPath ("Data\" & Table & ". xls") & ";" ' Note: The table variable here is the filename and can be obtained by the previous method
Conn_qc. Open Driver & DBPath & Dbparm
Get the name of the first sheet
Set RS=CONN_QC. OpenSchema (20)
TableName = RS ("table_name")
Rs. Close
Querying data
Sql= "SELECT * FROM [" & TableName & "]"
Response.Write (SQL)
' Set Rs=conn.execute (SQL)
Rs.Open sql, CONN_QC, 1, 1 ' Here you can solve the RecordCount-1 problem
If Rs.recordcount<>0 Then
%>
<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" >
<tr>
<%for i=0 to Rs.fields.count-1%>
<TD align= "center" valign= "Middle" bgcolor= "#F2F8FF" ><% =rs (i). Name%></td>
<%next%>
</tr>
<tr>
<%for i=0 to Rs.fields.count-1%>
<TD align= "center" valign= "middle" class= "F" ><%=rs (i)%></td>
<%next%>
</tr>
</table>
<%
End If
Rs.close
Set rs=nothing
Conn_qc.close
%>