J
James
I'm querying an Excel Spreadsheet and populating a DataSet with the returned
data. This works fine, and I can bind to a datagrid without problem.
That's assuming I have the first row containing the column headings. If my
first row is data and *not* headings, I want to treat it as if there are
columns called Column0, Column1, Column2, etc.
If I iterate through the columns in the DataTable and set the ColumnName, it
seems to overwrite the first row of data, which I obviously can't have. The
alternative solution (I anticipated) would be to add a record after the bind
with Column0, Column1, etc. etc...but apparently after binding to Excel, the
DataTable has knowledge of the datatype, so if it makes the column of type
Double, then I can't very well add "Column4" in the first row, because the
cast will fail.
I've been scratching my head for far too long on this. Probably overlooking
something very simple, please enlighten me!
data. This works fine, and I can bind to a datagrid without problem.
That's assuming I have the first row containing the column headings. If my
first row is data and *not* headings, I want to treat it as if there are
columns called Column0, Column1, Column2, etc.
If I iterate through the columns in the DataTable and set the ColumnName, it
seems to overwrite the first row of data, which I obviously can't have. The
alternative solution (I anticipated) would be to add a record after the bind
with Column0, Column1, etc. etc...but apparently after binding to Excel, the
DataTable has knowledge of the datatype, so if it makes the column of type
Double, then I can't very well add "Column4" in the first row, because the
cast will fail.
I've been scratching my head for far too long on this. Probably overlooking
something very simple, please enlighten me!