Dealing with fields containing unescaped double quotes with TextFieldParser

后端 未结 6 924
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 09:56

I am trying to import a CSV file using TextFieldParser. A particular CSV file is causing me problems due to its nonstandard formatting. The CSV in question has its fields

6条回答
  •  庸人自扰
    2021-01-04 10:27

    If you dont set HasFieldsEnclosedInQuotes = true the resultant list of columns will be more if the data contains (,) comma. e.g "Col1","Col2","Col3" "Test1", 100, "Test1,Test2" "Test2", 200, "Test22" This file should have 3 columns but while parsing you will get 4 fields which is wrong.

提交回复
热议问题