Hi,
I am getting the following Exception:
Exception Details: System.Data.SqlClient.SqlException: Invalid column name '[User].[UserID'.
when using GroupByCollection
I am using the following code:
private int TotalMembers(StaticStatisticType statType)
{
ResultsetFields fields = new ResultsetFields(2);
fields.DefineField(UserFieldIndex.UserID, 1, "Number Of Members", "[User]", AggregateFunction.CountDistinct);
fields.DefineField(UserFieldIndex.IsDeleted, 0, "User", "[User]");
IPredicateExpression filter = new PredicateExpression();
IRelationCollection relations = new RelationCollection();
switch (statType)
{
case StaticStatisticType.Inactive:
this.InactiveFilter(filter, relations);
break;
case StaticStatisticType.Active:
this.ActiveFilter(filter, relations);
break;
case StaticStatisticType.Teaching:
this.TeachingFilter(filter, relations);
break;
case StaticStatisticType.Support:
this.SupportFilter(filter, relations);
break;
case StaticStatisticType.Deleted:
default:
this.DeletedFilter(filter, relations);
break;
}
filter.Add(PredicateFactory.CompareValue(UserFieldIndex.GroupID, ComparisonOperator.Equal, 1));
IGroupByCollection groupByClause = new GroupByCollection();
groupByClause.Add(fields[0]);
groupByClause.Add(fields[1]);
int[] fieldsToGroupBy;
fieldsToGroupBy = new int[1];
fieldsToGroupBy[0] = 0;
DataTable dynamicList = new DataTable();
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, dynamicList, 0, null, filter, relations, true, groupByClause, null, 0, 0);
int howMany = dynamicList.Rows.Count;
return howMany;
}
where the filters just add to the filter and relation collections. StaticStatisticType is an enumeration. When I get this error, It seems to be just missing the closing "]" from the query.
I have downloaded the latest version and tried that,but it is still the same.
Any ideas?
Thanks
Richard