anyone ??
i just need that it reads the whole file,now it reads the last entry in the csv
Announcement
Collapse
No announcement yet.
need help with this script
Collapse
X
-
need help with this script
This is the original script , but it gives me some errors , i dont know why
PHP Code:<%Option Explicit%>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<%
Dim objFSO,oInStream,sRows,arrRows
Dim sFileName
sFileName = "C:\Program Files (x86)\HomeSeer HS3\html\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
End If
'*** Open Files ***'
Set oInStream = objFSO.OpenTextFile(Server.MapPath(sFileName),1,False)
%>
<table width="800" 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,",")
Loop
%>
<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>
<%
oInStream.Close()
Set oInStream = Nothing
%>
</table>
</body>
</html>
This is ,the script i edited script , it works but it only reads the 4th line of my csv... what did i do wrong ? normal i see a whole list ...
PHP Code:<%Option Explicit%>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<%
Dim objFSO,oInStream,sRows,arrRows
Dim sFileName
sFileName = "C:\Program Files (x86)\HomeSeer HS3\html\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
End If
'*** Open Files ***'
Set oInStream = objFSO.OpenTextFile(Server.MapPath(sFileName),1,False)
%>
<table width="800" 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,",")
Loop
%>
<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>
<%
oInStream.Close()
Set oInStream = Nothing
%>
</table>
</body>
</html>
csv file needs this input :
value1,value2,value3,value4,value5,value6Last edited by Malosa; December 11, 2015, 01:19 PM.Tags: None
Leave a comment: