I changed into the following:
ResultsetFields fields = new ResultsetFields(2);
fields.DefineField(Item.Type, 0, "Type", "Items");
fields.DefineField(Item.Type, 1, "Aantal", "Items", AggregateFunction.Count);
IGroupByCollection groupBy = new GroupByCollection();
groupBy.Add(fields[0]);
DataTable results = new DataTable();
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, results, 0, null, null, null, true, groupBy, null, 0, 0);
But thes errors popup:
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator
in class: "TypedListDAO.cs" function: "public bool GetMultiAsDataTable(...)"
generated sql:
SELECT [Items].[type] AS [Type],
COUNT([Items].[type]) AS [Aantal]
FROM [database].[dbo].[tbl_message] AS [Items]
GROUP BY [Items].[type]