Object reference not set to an instance of an object

Posts   
 
    
vasya
User
Posts: 4
Joined: 09-Nov-2005
# Posted on: 09-Nov-2005 13:35:34   

Hello.

I got error and can't find point where begin to solve it. I use version: 1.0.2005.1 Final

I have next error:

Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: Line 53: public bool GetMultiAsDataTable(IEntityFields fieldsToReturn, DataTable tableToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, bool allowDuplicates, IGroupByCollection groupByClause, ITransaction transactionToUse, int pageNumber, int pageSize) Line 54: { Line 55: return base.PerformGetMultiAsDataTableAction(fieldsToReturn, tableToFill, maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, allowDuplicates, groupByClause, transactionToUse, pageNumber, pageSize); Line 56: }

Line 57:

so as you see exception constantly occurs in:

dao.GetMultiAsDataTable(null, dynamicList, 0, null, null, null, true, null, null, 0, 0);

even if i use 'null' filter and 'null' fields

I regenerate project and it's uptodate, reinclude project, and i clean VS Cache

any supposition ??

vasya

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-Nov-2005 13:53:33   

You pass null for fields? You should pass in a valid fields object and datatable object. Could you paste the code you use to call the dao method please?

Frans Bouma | Lead developer LLBLGen Pro
vasya
User
Posts: 4
Joined: 09-Nov-2005
# Posted on: 09-Nov-2005 14:00:59   

sql:

            //SELECT Instructor_Registration.Inst_Class_ID, Modules.Module_Code Classes.Class_Name Term.Term_Name - Instructor_Registration.Class_Session AS ClassName
            //FROM Modules, Term, Classes, Instructor_Registration
            //WHERE Classes.Class_ID = Instructor_Registration.Class_ID
            //and Term.Term_Number = Classes.Term_Number and Term.Term_Number >  & current_term &  and Classes.Class_Start_Date <= getdate()

//and Modules.Module_Code = Classes.Module_Code and Ucase(Instructor_Registration.Instr_Login_ID)=Ucase('" & i_id & "')

code:

    Instructor_DB.HelperClasses.ResultsetFields fields = new Instructor_DB.HelperClasses.ResultsetFields(5);
fields.DefineField(Instructor_DB.InstructorRegistrationFieldIndex.InstClassId, 0, "InstClassId", "InstClassId");
fields.DefineField(Instructor_DB.ModulesFieldIndex.ModuleCode, 1, "ModuleCode", "ClassName");
fields.DefineField(Instructor_DB.ClassesFieldIndex.ClassName, 1, "ClassName", "ClassName");
fields.DefineField(Instructor_DB.TermFieldIndex.TermName, 1, "TermName", "ClassName");
fields.DefineField(Instructor_DB.InstructorRegistrationFieldIndex.ClassSession, 1, "ClassSession", "ClassName");

IPredicateExpression filter = new PredicateExpression();
////
//WHERE Classes.Class_ID = Instructor_Registration.Class_ID
filter.Add(new FieldCompareExpressionPredicate(Instructor_DB.FactoryClasses.EntityFieldFactory.Create(Instructor_DB.ClassesFieldIndex.ClassId),
    ComparisonOperator.Equal, new Expression(Instructor_DB.FactoryClasses.EntityFieldFactory.Create(Instructor_DB.InstructorRegistrationFieldIndex.ClassId)), "InstClassId"));

//and Term.Term_Number = Classes.Term_Number
filter.AddWithAnd(new FieldCompareExpressionPredicate(Instructor_DB.FactoryClasses.EntityFieldFactory.Create(Instructor_DB.TermFieldIndex.TermNumber),
    ComparisonOperator.Equal, new Expression(Instructor_DB.FactoryClasses.EntityFieldFactory.Create(Instructor_DB.ClassesFieldIndex.TermNumber)), "ClassName"));

//and Term.Term_Number > current_term
filter.AddWithAnd(Instructor_DB.FactoryClasses.PredicateFactory.CompareValue(Instructor_DB.TermFieldIndex.TermNumber, ComparisonOperator.GreaterThan, current_term, "ClassName"));

//and Classes.Class_Start_Date <= getdate()
filter.AddWithAnd(Instructor_DB.FactoryClasses.PredicateFactory.CompareValue(Instructor_DB.ClassesFieldIndex.ClassStartDate, ComparisonOperator.LessEqual,  DateTime.Now, "ClassName"));

//and Modules.Module_Code = Classes.Module_Code 
filter.AddWithAnd(new FieldCompareExpressionPredicate(Instructor_DB.FactoryClasses.EntityFieldFactory.Create(Instructor_DB.ModulesFieldIndex.ModuleCode),
    ComparisonOperator.Equal, new Expression(Instructor_DB.FactoryClasses.EntityFieldFactory.Create(Instructor_DB.ClassesFieldIndex.ModuleCode)), "ClassName"));

//and Upper(Instructor_Registration.Instr_Login_ID) = Upper('" + i_id + "');
filter.AddWithAnd(Instructor_DB.FactoryClasses.PredicateFactory.CompareValue(Instructor_DB.InstructorRegistrationFieldIndex.InstrLoginId, ComparisonOperator.Equal, i_id, "ClassName"));

DataTable dynamicList = new DataTable();
Instructor_DB.DaoClasses.TypedListDAO dao = new Instructor_DB.DaoClasses.TypedListDAO();
dao.GetMultiAsDataTable(fields, dynamicList, 0, null, filter, null, true, null, null, 0, 0);
vasya
User
Posts: 4
Joined: 09-Nov-2005
# Posted on: 09-Nov-2005 14:08:14   

something with alignment, may be better send it like text ..?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-Nov-2005 15:00:14   

vasya wrote:

something with alignment, may be better send it like text ..?

No it's the double quote you left dangling in the text. The ubb parser then doesn't push back the error.

Frans Bouma | Lead developer LLBLGen Pro
vasya
User
Posts: 4
Joined: 09-Nov-2005
# Posted on: 10-Nov-2005 16:21:10   

Otis wrote:

vasya wrote:

something with alignment, may be better send it like text ..?

No it's the double quote you left dangling in the text. The ubb parser then doesn't push back the error.

Well.. Guys could you share with me your suppositions about noted problem ??

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Nov-2005 17:05:35   

vasya wrote:

Otis wrote:

vasya wrote:

something with alignment, may be better send it like text ..?

No it's the double quote you left dangling in the text. The ubb parser then doesn't push back the error.

Well.. Guys could you share with me your suppositions about noted problem ??

My Appology, I forgot to flag it for bugfixing yesterday, I'm looking into it now.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Nov-2005 17:11:32   

What's wrong is this:


   Instructor_DB.HelperClasses.ResultsetFields fields = new Instructor_DB.HelperClasses.ResultsetFields(5);
fields.DefineField(Instructor_DB.InstructorRegistrationFieldIndex.InstClassId, 0, "InstClassId", "InstClassId");
fields.DefineField(Instructor_DB.ModulesFieldIndex.ModuleCode, 1, "ModuleCode", "ClassName");
fields.DefineField(Instructor_DB.ClassesFieldIndex.ClassName, 1, "ClassName", "ClassName");
fields.DefineField(Instructor_DB.TermFieldIndex.TermName, 1, "TermName", "ClassName");
fields.DefineField(Instructor_DB.InstructorRegistrationFieldIndex.ClassSession, 1, "ClassSession", "ClassName");

first, you add all fields to postion 1 simple_smile (copy/paste error I think wink ). So you should correct the indices second, you specify an object alias. You don't have to do that, as you don't specify any relations. So the second strings in every call should be omitted, as no relations are specified.

Frans Bouma | Lead developer LLBLGen Pro