M
Michael Gooding
Can anyone tell me why when using a .csv file called book1.csv with the
values below the code below does not recognise values read in after the
first line in a loop.
please feel free to run the code to see what I mean:
book1.csv:
RGB01,1,2,3,4
RGB02,1,2,3,4
RGB03,1,2,3,4
RGB04,1,2,3,4
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<%
csv_to_read="book1.csv"
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath(csv_to_read))
imported_text = act.readline
imported_text = replace(imported_text,chr(13),",")
imported_text = replace(imported_text,chr(34),"")
split_text=split(imported_text,",")
num_imported=ubound(split_text)+1
total_imported_text = act.readall
total_imported_text = replace(total_imported_text,chr(13),",")
total_imported_text = replace(total_imported_text,chr(34),"")
total_split_text=split(total_imported_text,",")
total_num_imported=ubound(total_split_text)
dim pinstore(500)
Dim I
Dim iCols
counter = 0
for i = 0 to (num_imported -1) step 1
if i mod num_imported = 0 then
pinstore(counter) = cstr(split_text(i))
counter = counter + 1
end if
next
for i = 0 to (total_num_imported - 1) step 1
if i mod num_imported = 0 then
pinstore(counter) = cstr(total_split_text(i))
counter = counter + 1
end if
next
for i = 0 to counter -1
response.write pinstore(i) & " Is in the list<br>"
if pinstore(i) = "RGB01" then
response.write Pinstore(i) & " = Matched<p>"
end if
if pinstore(i) = "RGB02" then
response.write Pinstore(i) & " = Matched<p>"
end if
if pinstore(i) = "RGB03" then
response.write Pinstore(i) & " = Matched<p>"
end if
if pinstore(i) = "RGB04" then
response.write Pinstore(i) & " = Matched<p>"
end if
next
%>
</body>
</html>
values below the code below does not recognise values read in after the
first line in a loop.
please feel free to run the code to see what I mean:
book1.csv:
RGB01,1,2,3,4
RGB02,1,2,3,4
RGB03,1,2,3,4
RGB04,1,2,3,4
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<%
csv_to_read="book1.csv"
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath(csv_to_read))
imported_text = act.readline
imported_text = replace(imported_text,chr(13),",")
imported_text = replace(imported_text,chr(34),"")
split_text=split(imported_text,",")
num_imported=ubound(split_text)+1
total_imported_text = act.readall
total_imported_text = replace(total_imported_text,chr(13),",")
total_imported_text = replace(total_imported_text,chr(34),"")
total_split_text=split(total_imported_text,",")
total_num_imported=ubound(total_split_text)
dim pinstore(500)
Dim I
Dim iCols
counter = 0
for i = 0 to (num_imported -1) step 1
if i mod num_imported = 0 then
pinstore(counter) = cstr(split_text(i))
counter = counter + 1
end if
next
for i = 0 to (total_num_imported - 1) step 1
if i mod num_imported = 0 then
pinstore(counter) = cstr(total_split_text(i))
counter = counter + 1
end if
next
for i = 0 to counter -1
response.write pinstore(i) & " Is in the list<br>"
if pinstore(i) = "RGB01" then
response.write Pinstore(i) & " = Matched<p>"
end if
if pinstore(i) = "RGB02" then
response.write Pinstore(i) & " = Matched<p>"
end if
if pinstore(i) = "RGB03" then
response.write Pinstore(i) & " = Matched<p>"
end if
if pinstore(i) = "RGB04" then
response.write Pinstore(i) & " = Matched<p>"
end if
next
%>
</body>
</html>