I think I have solved this problem now.
It looks like it was because, oDS, my object reference was going out of scope when the forms load event finished.
I have made oDS public now and all seems ok.
Should I have made oDS a property of my form instead of a variable.
Would this slow things down?
>I am trying to create my first business object based on a session object.
>When I use it from the command line it works fine.
>
>How ever when I try to run it from the load event of my form, the session object's destroy event runs and clears out my data session.
>
>I think this is because the form is trying to establish its own private data session.
>
>I have the form set to private data session.
>
>What am I doing wrong here.
>
>Many Thanks
>
>
>
>
>
>
>
>
>
>
>****
>******************************************************************************
>* This prg contains all the programmatically created classes that are used with IJCTND
>
>
>********************************************************************************************
>* Data Session Class.
>* Most of the Biz Objects below are based on this data session class
>********************************************************************************************
>Define CLASS DSClass AS Custom
> *oSession=0
> Hidden oSession &&=0 && You don't want people to be able to change this
> DataSessionID=0
> Procedure Init
> Lparam lcSessName
> This.oSession = CREATEOBJECT("Session")
> This.oSession.Name = iif(vartype(lcSessName)='C',lcSessName,"DataSession")
> Set DATASESSION TO (This.oSession.DataSessionID)
> Wait window This.oSession.Name+ ' (' + trans(set('datasession')) +')' nowait
> this.DataSessionID=This.oSession.DataSessionID
> Endproc
>
> Procedure UseTable
> Lparameter tcTable
>
> If NOT USED(tcTable)
> Use (tcTable) IN 0
> Endif
> Endproc
>
> Procedure Destroy
> SET STEP ON
> Close DATA ALL
> This.oSession = .NULL.
> Endproc
>
>Enddefine
>
>***************************************************************
>* This class is a sub class of the data session class
>* It outputs a tender as a set of tables ready for dispatch.
>****************************************************************
>Define CLASS prepfiles as DSClass
>*oSession=0 && You don't want people to be able to change this
>
> Procedure TEST
>
> Wait WINDOW 'I AM TEST IN THE SUBCLASS'
>
> Endproc
>
>
>
>Enddefine
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only