Quote:
"Input array is longer than the number of columns in this table"
Refer -
[MSDN] Adding Columns to a DataTable
[
^]
You need to add the Columns for
DataTable
before adding
Rows
to that.
dt.Columns.Add("Column1", typeof (string));
dt.Columns.Add("Column2", typeof (string));
dt.Columns.Add("Column3", typeof(string));
dt.Columns.Add("Column4", typeof(string));