Possible Bug? Column Headers.

43 views
Skip to first unread message

Jonathan Blodgett

unread,
Dec 29, 2015, 6:52:39 PM12/29/15
to CSVChat
I am using the CsvReader.ReadToEnd(true) to create a data table.  But the datatable does not use the first line of the csv for Column names and captions.  It uses column1, column2, column3 ... as if there isn't a header row. The rest of the data table looks correct.

If I delete the header line and replace it with Test1, Test2, Test3.  The datatable will have columns: Test1, Test2, Test3, column4, column5 ...

I feel there is something in my headerline that makes all the columns use default naming.

I have read the CSV format page and nothing jumps out at me.  Anyone have any ideas?

Wishing i could step through the code.
-Jonathan


shriop

unread,
Dec 29, 2015, 7:00:46 PM12/29/15
to CSVChat
Columns in a DataTable are required to have unique names. Instead of throwing an exception if duplicate column names are encountered on the header line there is code in CsvReader.ReadToEnd that switches to default index based naming for the columns.

There is a source code purchasing option on the site that would allow you to step through any of the code.

Bruce Dunwiddie
Reply all
Reply to author
Forward
0 new messages