R
rob
I am using Odbc to read cvs files. Unfortunately, some cvs files are
not formated correctly (out of my control). One particular problem is
that a quote within an item is not put in double quotes, i.e. the file
says
"this "item" is bad", "this item is ok"
rather then
"this ""item"" is bad", "this item is ok"
odbc now thinks 'this ' is the first item rather then 'this "item" is
bad'. Excel reads the file just fine, though. Is there some workaround,
short of fixing the file myself, to make the driver more error
tolerant? If it helps anything bellow is how I read the excel file.
Thanks
connectionString = @"Driver={Microsoft Text Driver (*.txt;
*.csv)};DBQ=" + Path.GetDirectoryName(filename);
connection = new OdbcConnection(connectionString);
connection.Open();
command = new OdbcCommand("Select * FROM " +
Path.GetFileName(filename), connection);
reader = command.ExecuteReader();
not formated correctly (out of my control). One particular problem is
that a quote within an item is not put in double quotes, i.e. the file
says
"this "item" is bad", "this item is ok"
rather then
"this ""item"" is bad", "this item is ok"
odbc now thinks 'this ' is the first item rather then 'this "item" is
bad'. Excel reads the file just fine, though. Is there some workaround,
short of fixing the file myself, to make the driver more error
tolerant? If it helps anything bellow is how I read the excel file.
Thanks
connectionString = @"Driver={Microsoft Text Driver (*.txt;
*.csv)};DBQ=" + Path.GetDirectoryName(filename);
connection = new OdbcConnection(connectionString);
connection.Open();
command = new OdbcCommand("Select * FROM " +
Path.GetFileName(filename), connection);
reader = command.ExecuteReader();