I'm trying to add a new column to an already existing DataTable using c#.
The best I could do is to actually copy each DataRow as explained in here and here but with no success since those answers specifically say that both DataTable must have the same columns. Whenever I try to add any kind of value to the new column (which is at the end of a new DataTable named dt I'm left with a DataTable with the same number of rows but no values at all.
foreach (DataRow dr in ret.Rows)
{
dt.Rows.Add(dr.ItemArray, "1");
}
ret is a DataTable with X columns and N Rows.
dt is a DataTable with X+1 columns and N Rows.