I want to create a query that groups by 2 fields and does a count of those combined fields using Linq and C#. I then want to write the query to another DataTable. The current problem I am having is the Foreach Staement is returning an error about the input file being too large. I am not clear on what the .Key does. (I borrowed code from other posts.) I need both Type and Stage to be grouped together. What is the correct syntax that I need? Thank you.
      var GroupedDataQuery = from row in dTableFilteredCol1.AsEnumerable()
                               group row by row.Field<string>("Type")
                               into grp 
                               select new {
                                   Type = grp.Key,
                                   Stage = grp.Key,
                                   A_Count = grp.Count() 
                               };
        //
        DataTable dTable = new DataTable();
        foreach (var result in GroupedDataQuery)
        {
            dTable.Rows.Add(
            new object[] 
            {
             result.Type,
             result.Stage,
             result.A_Count
            });
        }
        return dTable;
    }
 
    