I need to create a dynamic DataTable
of the genre:
List<p> =...
List<l>=....
DataTable dt = new DataTable();
foreach (Prod pr in p)
{
dt.Columns.Add(prod.Nome.Trim());
for (int i = 0; i < l.Count; i++)
{
dt.Rows.Add(GetDados(pr,l[i]),GetDados(pr,l[i])...);
}
}
My problem is within for
, how can I insert rows into the datable, when those rows are not defined, and the number of columns is dynamic?