GetMultiAsDataTable does not work - Help

Posts   
 
    
Posts: 40
Joined: 01-Sep-2005
# Posted on: 12-Sep-2005 06:22:41   

What am I doing wrong ??? The 9th parameter of "GetMultiAsDataTable" keeps producing a runtime error of "Object reference not set to an instance of an object." I have tried passing "null" and a Transaction as below - both produce the same error. I do not need a transaction, I just want this to work... [NB This is running in .NET 2.0]

  DataTable ResultData = null;
  TypedListDAO DataList = null;
  ResultsetFields Fields = null;
  IRelationCollection Joins = null;
  IPredicate Filter = null;
  ISortExpression SortOrder = null;

  Fields = new ResultsetFields(8 );
  Fields.DefineField(StudycontractFieldIndex.Studycontractuid, 0, "SCUID");
  Fields.DefineField(StudycontractFieldIndex.Stcocontractid, 1, "Contract ID");
  Fields.DefineField(OtentryFieldIndex.Oteuid, 2, "OTEUID");
  Fields.DefineField(OtentryFieldIndex.Otenametext, 3, "OTE Name");
  Fields.DefineField(SccomponentFieldIndex.Sccomponentuid, 4, "SCCUID");
  Fields.DefineField(SccomponentFieldIndex.Sccomshortnametext, 5, "SC Name");
  Fields.DefineField(OtcomponentFieldIndex.Otcuid, 6, "OTCUID");
  Fields.DefineField(OtcomponentFieldIndex.Otcshortnametext, 7, "OTC Name");
  Joins = new RelationCollection();
  Joins.Add(OtentryEntity.Relations.StudycontractEntityUsingOteuid);
  Joins.Add(SccomponentEntity.Relations.StudycontractEntityUsingStudycontractuid, JoinHint.Left);
  Joins.Add(OtcomponentEntity.Relations.SccomponentEntityUsingOtcuid);
  Filter = PredicateFactory.CompareValue(OtentryFieldIndex.Otereportingyear,
                                         ComparisonOperator.Equal,
                                         Int32.Parse("2004"));

  SortOrder = new SortExpression();
  SortOrder.Add(SortClauseFactory.Create(OtentryFieldIndex.Otenametext, SortOperator.Ascending));
  SortOrder.Add(SortClauseFactory.Create(OtcomponentFieldIndex.Otcshortnametext, SortOperator.Ascending));

  Transaction Txn = new Transaction(IsolationLevel.ReadCommitted, "AServer");
  DataList.GetMultiAsDataTable(Fields, ResultData, 0, SortOrder, Filter, Joins, true, null, Txn, 0, 0);
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Sep-2005 09:56:35   

Please paste a stacktrace.

Frans Bouma | Lead developer LLBLGen Pro
sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 12-Sep-2005 12:14:39   

Paul, DataList is null in the listing. Do you instsantiate it some where else? If not please try it.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Sep-2005 13:05:09   

sparmar2000 wrote:

Paul, DataList is null in the listing. Do you instsantiate it some where else? If not please try it.

Good catch, ResultData is also not initialized.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 40
Joined: 01-Sep-2005
# Posted on: 13-Sep-2005 00:22:51   

Oops - yes you were right... create the objects and suddenly it all works flushed Thanks...