Hi All,
I am having a list of DB objects in a datatable.
ID ObjectType, ObjectName
1 StoredProcedure, usp_getList
2 Table, tbl_Users
3 Function, udf_getNames
4 View, v_Changes
5 Table, tbl_Admin
6 Function, udf_SplitString
I need to group them by each object type and then sort it according to the object name.
ID ObjectType, ObjectName
1 Function, udf_getNames
2 Function, udf_SplitString
3 StoredProcedure, usp_getList
4 Table, tbl_Admin
5 Table, tbl_Users
6 View, v_Changes
I tried the following code, but it seems not working
DataView dv = new DataView(tbl);
dv.Sort = "ObjectType ASC";
var groupbyfilter = from d in tbl.AsEnumerable() group d by d["ObjectType "];
foreach (var x in groupbyfilter)
x.CopyToDataTable(tbl, LoadOption.OverwriteChanges);
Please help resolve this. Thanks in advance.