I have a untyped DataTable that looks like this (srcTbl):
date col_1 col_2 ... col_n
1.3.2010 00:00 12.5 0 ... 100
1.3.2010 01:00 0 0 ... 100
1.3.2010 22:00 0 0 ... 100
1.3.2010 23:00 12.5 0 ... 100
...
31.3.2010 00:00 2 0 ... 100
31.3.2010 01:00 2 0 ... 200
I need to sum up the rows grouped by dates to get a DataTable like that (dstTbl):
date, col_1 col_2 ... col_n
1.3.2010 15 0 ... 400
...
31.3.2010 4 0 ... 300
Is this possible by using LINQ and if then how?
Okay, So you can achieve it like this. This is a working version so you shouldn’t have much problem.
DataTable myDataTable = new DataTable();
myDataTable.Columns.Add("Date", typeof(DateTime));
myDataTable.Columns.Add("Col1", typeof(int));
myDataTable.Columns.Add("Col2", typeof(int));
myDataTable.Columns.Add("Col3", typeof(int));