I have a table that has description , price and amount of around 100 items and people(A,B..) who have entered their closest values for items in auction , is it possible to have a parent/child grouping on the columns using C# DataTable. Is there any way of achieving it as shown in excel format in C#. Thanks in advance.
Asked
Active
Viewed 47 times
-2
-
You are creating a PIVOT table. I've done this a lot. Like answer below you need to use a GroupBy. See a sample here :https://stackoverflow.com/questions/67371344/how-convert-sql-server-pivot-functionality-in-c-sharp-uisng-linq?force_isolation=true – jdweng Apr 20 '22 at 11:02
1 Answers
0
I think you have to use LINQ and first convert it to an IEnumerable or something with AsEnumerable, then use LINQ to select and group.
A sample can look like this:
var groupbyfilter= from d in MyDataSet.Tables["Somedata"].AsEnumerable() group d by d["SomeDataColumn"];
Or directly use LINQ GroupBy
Liquid Core
- 2,871
- 5
- 22
- 45