ASP reads Excel (. XSL) files

Source: Internet
Author: User
<HTML>
<Head>
<Title> Excel manipulation </title>
</Head>
<Body>
<H2 align = "center"> show Excel file examples </H2>
<Table border = "1" width = "90%" align = "center">
<Tr align = "center" bgcolor = "# e6e6e6">
<TD> Student ID </TD> <TD> name </TD> <TD> mathematics </TD> <TD> Chinese </TD> <TD> English </TD> <TD> total score </TD>
</Tr>
<%...
'Create a connection object
Dim dB, RS, strsql
Set DB = server. Createobject ("ADODB. Connection ")
DB. Open "driver = {Microsoft Excel Driver (*. xls)}; DBQ =" & server. mappath ("mark.xls ")
'Open record set. The table name must be in the format of "[Table Name $ ]".
Strsql = "select * from [sheet1 $]"
Set rs = dB. Execute (strsql)
'Read all rows cyclically
Do while not Rs. EOF
Response. Write "<tr align = 'center'>"
Response. Write "<TD>" & RS ("student ID") & "</TD>"
Response. Write "<TD>" & RS ("name") & "</TD>"
Response. Write "<TD>" & RS ("Mathematics") & "</TD>"
Response. Write "<TD>" & RS ("") & "</TD>"
Response. Write "<TD>" & RS ("English") & "</TD>"
Response. Write "<TD>" & RS ("Total") & "</TD>"
Response. Write "</tr>"
Rs. movenext
Loop

'Close the object
Rs. Close
Set rs = nothing
DB. Close
Set DB = nothing
%>
</Table>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.