ASP reads CSV files and outputs them in a table

Source: Internet
Author: User

I am simply playing with it. If you do not have this online practice, write it. The code is very simple. You can use it for reference.

Code Background: A Website access record made by myself. Because of the huge access volume and small virtual space, no database is used. CSV storage, in order to make it easy to read files without downloading them each time, this ASP is used to help read files.

. CSV file Introduction: http://baike.baidu.com/view/468993.htm

The algorithm is to use ASP code to open a text file (CSV), split a row into an array using the split function, and output one by one. After each row ends, a line feed mark is output.

<HTML> <title> Read records </title> <body> <p> CSV records are read as follows: </P> <p> <% set FS = server. createobject ("scripting. fileSystemObject ") set f = FS. opentextfile (server. mappath ("record.csv"), 1) 'Open the text file response. write ("<Table border =" "1"> ") 'creates the do while F table. atendofstream = falsestr = f. readlinesplitstr = Split (STR, ",") 'splits the response string of a row. write ("<tr>") 'creates a table row for I = 0 to ubound (splitstr) response. write ("<TD>") 'creates the table column response. write splitstr (I) response. write ("</TD>") nextresponse. write ("</tr>") loopresponse. write ("</table>") F. closeset F = nothingset FS = nothing %> </P> </body> 

Just a few simple lines of code are made to give a reference to beginners like me.

Reference page: http://icyfox.web-150.com/read.asp

This is webpage Effect

Related Article

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.