Læs linjer i fil
Hej ASP eksperterJeg er igang med mit første script, hvor jeg vil læse linjer fra en csv fil, men kan ikke rigtig få det til at virke. Her er min kode:
<%
' S discount file
' Læs fra fil
Set fso = CreateObject("Scripting.FileSystemObject")
filespec = Server.Mappath("s.csv")
Set f = fso.OpenTextFile(filespec,1)
splitLine = split(f.readline, "\n")
response.write "Ny linje split"
' Discount lines
Do While not f.AtEndOfStream
splitLine = split(f.readline, "\n")
for l = 1 to ubound(splitLine)
' Discount read
discount = split(splitLine, ";")
response.write "Split kolon"
' Discount write
for d = 0 to ubound(discount)
response.write discount(3) + " - " + discount(5) + " - " + discount(6) ' Number, discount and name
response.write "Udskriv nummer 3 5 og 6"
next
'
next
'
Loop
%>
s.csv ser således ud:
sdsd;sdsds;sdsds;sdsdsd;sdsdsds;sdsdsdd;sdsds;sdssc;
sdsd;sdsds;sdsds;sdsdsd;sdsdsds;sdsdsdd;sdsds;sdssb;
sdsd;sdsds;sdsds;sdsdsd;sdsdsds;sdsdsdd;sdsds;sdssa;
