GroupBy in datatable??
-
Hi, Is there a way to use groupBy in a datatable? I need to group some vaules in a column. I cannot use a sql query, as I am munipulating the data in the datatable for a gridview. I know there are no function/class available in asp.net, but maybe someone knows where to find something on the net, or had the same problem as me.
-
Hi, Is there a way to use groupBy in a datatable? I need to group some vaules in a column. I cannot use a sql query, as I am munipulating the data in the datatable for a gridview. I know there are no function/class available in asp.net, but maybe someone knows where to find something on the net, or had the same problem as me.
Hi, Yes, we can use aggrigate functions for DataTable. Here is the sample code. You can use group by also.
DataTable table = dataSet.Tables["Orders"]; object sumObject; sumObject = table.Compute("Sum(Total)", "EmpID = 5");
enjoy...regards GV Ramana
-
Hi, Yes, we can use aggrigate functions for DataTable. Here is the sample code. You can use group by also.
DataTable table = dataSet.Tables["Orders"]; object sumObject; sumObject = table.Compute("Sum(Total)", "EmpID = 5");
enjoy...regards GV Ramana
-
Hi, Is there a way to use groupBy in a datatable? I need to group some vaules in a column. I cannot use a sql query, as I am munipulating the data in the datatable for a gridview. I know there are no function/class available in asp.net, but maybe someone knows where to find something on the net, or had the same problem as me.
Try this code DataRow[] dr=DataTable.Select("gruopBy ColumnName"); Home this will help u? Best regard Pathan
GOD HELP THOSE WHO HELP THEMSELVES
-
Try this code DataRow[] dr=DataTable.Select("gruopBy ColumnName"); Home this will help u? Best regard Pathan
GOD HELP THOSE WHO HELP THEMSELVES
-
Hi Pathan, It looks like something that can help me, but where do I use it? Where I fill my new datatable, or from the current datatable?
HI. By this code You will get array of datarow, After that You can Import this array row in new table. Like this dataTable NewTable; Datarow dr[]=datatabale.Select("groupBy columnName"); foreach(datarow dr1 in dr) { NewTable.ImportRow(dr1); } Best Regard Pathan
GOD HELP THOSE WHO HELP THEMSELVES