Object Reference not set to an instance of an object

Posts   
 
    
Daniel9 avatar
Daniel9
User
Posts: 19
Joined: 05-Apr-2005
# Posted on: 14-Apr-2005 09:25:37   

Hi Frans,

I'm getting an error when retrieving a typed list from the database.

I have a number of typed lists that I am using successfully to bind to a grid. I can't see why this one won't work as it is very similar to the other ones.

Code to retrieve the list:

        static public OperationsPlantInputTypedList GetOperationsPlantInputTypedList()
        {
            OperationsPlantInputTypedList tl = new OperationsPlantInputTypedList();
            IDataAccessAdapter adapter = CreateAdapter();
            SortExpression sorter = new SortExpression(SortClauseFactory.Create(OperationFieldIndex.Time, SortOperator.Ascending));
            IRelationPredicateBucket bucket = (IRelationPredicateBucket)tl.GetRelationInfo();
            adapter.FetchTypedList(tl.GetFieldsInfo(), tl, bucket,0,sorter,false);
            
            return tl;
        }

I've tried re-syncronising the LLBL project and re-creating the list within LLBL.

As far as the database goes, there's an Operations table which has a DestinationUID as a FK and a PlantInput also has a DestinationUID as a FK and obviously a Destination table with a PK of DestinationUID. I am trying to retrieve all the rows in the table (there aren't any in there atm, but it should still bind right?)

Any ideas?

Stack Trace:


Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at SD.LLBLGen.Pro.DQE.SqlServer.SqlServerSpecificCreator.CreateObjectName(IFieldPersistenceInfo persistenceInfo)
   at SD.LLBLGen.Pro.ORMSupportClasses.RelationCollection.ToQueryText(Int32& uniqueMarker)
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32& uniqueMarker)
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize)
   at SMS_BusinessObjects.DatabaseSpecific.DataAccessAdapter.CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects, IPredicateExpression filter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) in C:\QmastorSMS\SMS_BusinessObjects\DatabaseSpecific\DataAccessAdapter.cs:line 590
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Boolean allowDuplicates)
   at SMS_BusinessObjects.DatabaseGeneric.MyBusinessObjects.DataManager.GetOperationsPlantInputTypedList() in c:\qmastorsms\sms_businessobjects\databasegeneric\mybusinessobjects\datamanager.cs:line 187
   at EntryPoint.MainForm.DisplayPlantInputRecordsInMainGrid() in c:\qmastorsms\entrypoint\mainform.cs:line 825
   at EntryPoint.MainForm.tvMain_AfterSelect(Object sender, TreeViewEventArgs e) in c:\qmastorsms\entrypoint\mainform.cs:line 765
   at System.Windows.Forms.TreeViewEventHandler.Invoke(Object sender, TreeViewEventArgs e)
   at System.Windows.Forms.TreeView.OnAfterSelect(TreeViewEventArgs e)
   at System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv)
   at System.Windows.Forms.TreeView.WmNotify(Message& m)
   at System.Windows.Forms.TreeView.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
   at System.Windows.Forms.Control.WmNotify(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   at System.Windows.Forms.Control.DefWndProc(Message& m)
   at System.Windows.Forms.TreeView.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.TreeView.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at EntryPoint.MainForm.Main() in c:\qmastorsms\entrypoint\mainform.cs:line 114The program '[3420] EntryPoint.exe' has exited with code 0 (0x0).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Apr-2005 11:05:35   

Please check if the database specific assembly in your application's execution folder is the latest one. This error occurs when persistence info for a field couldn't be retrieved, for example you added a field to the db, updated the project, generated code but you only updated the database generic assembly in the application's folder.

Frans Bouma | Lead developer LLBLGen Pro
Daniel9 avatar
Daniel9
User
Posts: 19
Joined: 05-Apr-2005
# Posted on: 15-Apr-2005 00:38:13   

Got it in one.

Thanks Frans smile