Handling double quotes within Delimited Values

Mar 21, 2014 at 5:33 PM
Edited Mar 21, 2014 at 5:45 PM
Hi,

I'm using version 3.0.0.0 but I'm having trouble reading a csv which has a QUote within a quote delimited value i.e "37" Televsion",

Is there a config option which will allow the dataSet.Fill option to process the row? At the moment it gives me the error
__DataTable has 38 columns, but a DataRecord had 54. The number of columns in the DataTable must match or exceed the number of values in each DataRecord.
__
I'm using the following

reader.ValueDelimiter = '"';
reader.ReadHeaderRecord();
dataSet.Fill(reader);

Thanks
Coordinator
Mar 21, 2014 at 11:34 PM
Hi,

If there's a quote within the delimited value, it needs to be escaped in order to be valid CSV. So your value should look like:
"37"" Television"
HTH,
Kent
Marked as answer by INnerDemonJ on 3/24/2014 at 9:51 AM
Mar 24, 2014 at 5:51 PM
Ok thanks I will talk to the provider of the CSV and see if i can get them to change their output mechanism