Hi,
Thanks for the answer.
// define fields
ResultsetFields fields = new ResultsetFields(6);
fields.DefineField(ReleasesFields.ReleaseId, 0, "ReleaseId", "Releases");
fields.DefineField(ReleasesFields.Header, 1, "Header", "Releases");
fields.DefineField(ReleasesFields.CreateDate, 2, "CreateDate", "Releases");
fields.DefineField(ReleasesFields.Intro, 3, "Intro", "Releases");
fields.DefineField(CategoriesFields.Name.SetObjectAlias("Categories"), 4, "CatName", "Categories");
fields.DefineField(AspnetUsersFields.UserName.SetObjectAlias("AspnetUsers"), 5, "UserName", "AspnetUsers");
SortExpression sortFilter = new SortExpression();
sortFilter.Add(ReleasesFields.CreateDate.SetObjectAlias("Releases") | SortOperator.Ascending);
// approve filter
IPredicateExpression customFilter = new PredicateExpression();
customFilter.Add(VerifyFields.IsApproved.SetObjectAlias("Verify") == "True"); // must be approved
// select filters
IPredicateExpression selectFilter = new PredicateExpression();
// relations to use
IRelationCollection relations = new RelationCollection();
relations.Add(ReleasesEntity.Relations.VerifyEntityUsingReleaseId, "Releases", "Verify", JoinHint.None).CustomFilter = customFilter;
relations.Add(ReleasesEntity.Relations.CategoriesEntityUsingCatId, "Releases", "Categories", JoinHint.Left);
relations.Add(ReleasesEntity.Relations.AspnetUsersEntityUsingUserId, "Releases", "AspnetUsers", JoinHint.None);
// group clause to use
IGroupByCollection groupByClause = new GroupByCollection();
groupByClause.Add(fields[0]);
groupByClause.Add(fields[1]);
groupByClause.Add(fields[2]);
groupByClause.Add(fields[3]);
groupByClause.Add(fields[4]);
groupByClause.Add(fields[5]);
// fetch data with the filters
DataTable dynamicList = new DataTable();
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, dynamicList, 0, sortFilter, selectFilter, relations, false, groupByClause, null, 0, 0);
exec sp_executesql N'SELECT DISTINCT [LPA_R2].[ReleaseId], [LPA_R2].[Header], [LPA_R2].[CreateDate], [LPA_R2].[Intro], [LPA_C3].[Name] AS [CatName], [LPA_A4].[UserName] FROM (((
[presszone2].[dbo].[Verify] [LPA_V1] INNER JOIN [presszone2].[dbo].[Releases] [LPA_R2] ON [LPA_V1].[ReleaseId]=[LPA_R2].[ReleaseId] AND ( [LPA_V1].[IsApproved] =
@IsApproved1)) LEFT JOIN [presszone2].[dbo].[Categories] [LPA_C3] ON [LPA_C3].[CatId]=[LPA_R2].[CatId]) INNER JOIN [presszone2].[dbo].[aspnet_Users] [LPA_A4] ON
[LPA_A4].[UserId]=[LPA_R2].[UserId]) GROUP BY [LPA_R2].[ReleaseId], [LPA_R2].[Header], [LPA_R2].[CreateDate], [LPA_R2].[Intro], [LPA_C3].[Name], [LPA_A4].[UserName] ORDER BY
[LPA_R2].[CreateDate] ASC',N'@IsApproved1 bit',@IsApproved1=1
I used the code you suggested and changed it to fit my needs (see c# code above), but the SQL query still looks the same, no paging gets done.
I think I will try to run the code just like you wrote it on the Northwind Database, to see if that works like i imagined
I will return
, but thanks for your time.