This job is to operate Excel in ASP, and mark every line in the whole program, and then do the same as filling in the blanks. Now I changed it to dynamically display items in each row, display them one by one, and finally make a summary.
1. FSO find the 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 to the Excel file and obtain 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 "";"
// Call the Open Method to open the database
Dbpath = "Data Source =" & server. mappath ("Data/" & table &". xls ") &"; "'Note: The table variable here is the file name, which can be obtained from the previous method.
Conn_qc.open driver & dbpath & dbparm
// Obtain the name of the first sheet
Set rs = conn_qc.openschema (20)
Tablename = RS ("table_name ")
Rs. Close
// Query data
SQL = "select * from [" & tablename & "]"
// Response. Write (SQL)
'Set rs = conn. Execute (SQL)
Rs. Open SQL, conn_qc, 1, 1' here, the recordcount is-1.
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
%>