i have a vbs file where i'm trying to read in a csv file.
my code (in part) looks like:
set cnn = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
cnn.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & csvfilepath & "Extended Properties=""text;HDR=Yes;"""
rs.open "select * from " & csvfilename, cnn, 3, 3
Do while rs.eof<> True
response.write rs.fields.item(2).name & " " & rs.fields.item(2).value
loop
When i run this file against a manually created CSV file (labelled "Good csv" below), everything works. The LOCATION field comes back appropriately. So for the first record, i get the value "R1"
However, if I replace the good csv with my other csv below, it only returns the numeric portion of the location field. So instead of returning "F1" , it returns "1". As a test, if i change the entire location field to be numeric, it works fine. If i change it to a string like "abc" nothing is returned.
Any help would be appreciated!!
Good csv
FILELOCATION,FILENAME,LOCATION,CATEGORY,GRAPHICTYPE,SYSTEM,DESCRIPTION
Water System 2/,Chiller.asp,R1,HVAC,E,CHW,"This is a description for this graphic"
Water System 2/,myChiller1.asp,R1,HVAC,E,CHW,"This is another description for a graphic"
Water System 2/,myChiller2.asp,R1,HVAC,E,CHW,"nothing useful"
bad csv
FILELOCATION,FILENAME,LOCATION,CATEGORY,GRAPHICTYPE,SYSTEM,DESCRIPTION
Aire/,Alarms.asp,F1,HVAC,E,REF,"Alarms"
Aire/,Main.asp,F1,HVAC,E,REF,""
Aire/,SB1 revamp.asp,,,,,
my code (in part) looks like:
set cnn = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
cnn.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & csvfilepath & "Extended Properties=""text;HDR=Yes;"""
rs.open "select * from " & csvfilename, cnn, 3, 3
Do while rs.eof<> True
response.write rs.fields.item(2).name & " " & rs.fields.item(2).value
loop
When i run this file against a manually created CSV file (labelled "Good csv" below), everything works. The LOCATION field comes back appropriately. So for the first record, i get the value "R1"
However, if I replace the good csv with my other csv below, it only returns the numeric portion of the location field. So instead of returning "F1" , it returns "1". As a test, if i change the entire location field to be numeric, it works fine. If i change it to a string like "abc" nothing is returned.
Any help would be appreciated!!
Good csv
FILELOCATION,FILENAME,LOCATION,CATEGORY,GRAPHICTYPE,SYSTEM,DESCRIPTION
Water System 2/,Chiller.asp,R1,HVAC,E,CHW,"This is a description for this graphic"
Water System 2/,myChiller1.asp,R1,HVAC,E,CHW,"This is another description for a graphic"
Water System 2/,myChiller2.asp,R1,HVAC,E,CHW,"nothing useful"
bad csv
FILELOCATION,FILENAME,LOCATION,CATEGORY,GRAPHICTYPE,SYSTEM,DESCRIPTION
Aire/,Alarms.asp,F1,HVAC,E,REF,"Alarms"
Aire/,Main.asp,F1,HVAC,E,REF,""
Aire/,SB1 revamp.asp,,,,,