Invalid column exception - missing "]"

Posts   
 
    
Richard
User
Posts: 6
Joined: 12-Apr-2005
# Posted on: 26-Sep-2005 14:20:53   

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

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 26-Sep-2005 16:25:40   

Could you please specify which LLBLGen Pro version you are using, as well as the file version for the following runtime libraries:

SD.LLBLGen.Pro.DQE.SqlServer.NET11.dll

SD.LLBLGen.Pro.ORMSupportClasses.NET11.dll

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 27-Sep-2005 15:14:18   

Hi Richard,

Please use the database object name without square brackets or braces.

i.e use User instead of [User] or (User)

Good Luck