<%Option Explicit%>
<html>
<head>
<title>ThaiCreate.Com ASP & Write CSV</title>
</head>
<body>
<%
Dim objFSO,oFiles
Dim sFileName
sFileName = "customer.csv"
'*** Create Object ***'
Set objFSO = CreateObject("Scripting.FileSystemObject")
'*** Create Text Files ***'
Set oFiles = objFSO.CreateTextFile(Server.MapPath(sFileName), 2)
oFiles.WriteLine("C001,Win Weerachai,[email protected],TH,1000000,600000")
oFiles.WriteLine("C002,John Smith,[email protected],EN,2000000,800000")
oFiles.WriteLine("C003,Jame Born,[email protected],US,3000000,600000")
oFiles.WriteLine("C004,Chalee Angel,[email protected],US,4000000,100000")
oFiles.Close()
Set oFiles = Nothing
Set objFSO = Nothing
Response.write"<br>Generate CSV Done.<br><a href="&sFileName&">Download</a>"
%>
</table>
</body>
</html>