I have numeric data in a text file with column headers. I found a great solution for reading string data into a datatable here
Reading Comma Delimited Text File to C# DataTable, columns get truncated to 255 characters
I tried to adapt it for numeric data with no success. After I converted the string array to a double array I tried to add a row like this
myDatatable.Rows.Add(myDoubleArray)
which foes not seem to give me anything. I didi try to convert the double to objects and stick numbers in as in the code below:
var objectNumbers = rowData.Cast<object>().ToList();
data.Rows.Add();
for (var j = 0; j < columns.Length; j++)
{
data.Rows[data.Rows.Count - 1][j] = objectNumbers[j];
}
Then I ended up with the numbers as strings.