Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP CSV > ASP Read CSV files



Clound SSD Virtual Server

ASP Read CSV files

ASP Read CSV files สำหรับ ASP นั้นไม่มี Function ในการอ่านไฟล์ CSV โดยตรงน่ะครับ แต่เราจะใช้การอ่านในรูปแบบของ Text Files และทำการตัดออกมาเป็น Array โดยใช้เครื่องหมาย , เป็นตัวระบุในการแบ่ง Column

ตัวอย่าง

AspCSV.asp

<%Option Explicit%>
<html>
<head>
<title>ThaiCreate.Com ASP  & Read CSV</title>
</head>
<body>
<%
Dim objFSO,oInStream,sRows,arrRows
Dim sFileName

sFileName = "customer.csv"

'*** Create Object ***'
Set objFSO = CreateObject("Scripting.FileSystemObject") 

'*** Check Exist Files ***'
If Not objFSO.FileExists(Server.MapPath(sFileName)) Then
	Response.write("File not found.")
Else

'*** Open Files ***'
Set oInStream = objFSO.OpenTextFile(Server.MapPath(sFileName),1,False)

%>
<table width="600" border="1">
  <tr>
    <th width="91"> <div align="center">CustomerID </div></th>
    <th width="98"> <div align="center">Name </div></th>
    <th width="198"> <div align="center">Email </div></th>
    <th width="97"> <div align="center">CountryCode </div></th>
    <th width="59"> <div align="center">Budget </div></th>
    <th width="71"> <div align="center">Used </div></th>
  </tr>
<%
Do Until oInStream.AtEndOfStream 
sRows = oInStream.readLine
arrRows = Split(sRows,",")
%>
  <tr>
    <td><div align="center"><%=arrRows(0)%></div></td>
    <td><%=arrRows(1)%></td>
    <td><%=arrRows(2)%></td>
    <td><div align="center"><%=arrRows(3)%></div></td>
    <td align="right"><%=FormatNumber(arrRows(4),2)%></td>
    <td align="right"><%=FormatNumber(arrRows(5),2)%></td>
  </tr>
<%
Loop

oInStream.Close()
Set objFSO = Nothing
Set oInStream = Nothing

End IF
%>
</table>
</body>
</html>

Screenshot

ASP & CSV



Asp Excel บทความเกี่ยวกับการเขียน ASP กับ Microsoft Excel







   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-08-10 16:56:25 / 2008-12-11 07:33:34
  Download : Download  ASP Read CSV files
 Sponsored Links / Related

 
ASP CSV and ADO (Provider=Microsoft.Jet.OLEDB.4.0; Data Source)
Rating :

 
ASP CSV and ODBC (Driver={Microsoft Text Driver (*.txt; *.csv)})
Rating :

 
ASP CSV & ADO Insert Record (Driver={Microsoft Text Driver (*.txt; *.csv)})
Rating :

 
ASP Write/Export to CSV files
Rating :

 
ASP Read CSV Import/Insert Ms Access
Rating :

 
ASP Write/Export Database to CSV
Rating :

 
ASP Upload CSV and Import to Database
Rating :

 
ASP Export to CSV and Send Email Attachment
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่