Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Session object data
Message
From
19/06/1999 11:50:54
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00231653
Message ID:
00231763
Views:
19
>>>>local os, od, oc
>>>>os=create('ss')
>>>>os.od.oc.getdata
>>>>os=null
>>>>
>>>>define class ss as session
>>>> od=null
>>>> datasession = 2
>>>> function init
>>>> this.od=create('dd')
>>>> endfunc
>>>>enddefine
>>>>
>>>>define class dd as dataenvironment
>>>> autoopentables=.t.
>>>> function init
>>>> this.addobject('oc','cc')
>>>> with this.oc
>>>> .cursorsource="custs"
>>>> .database="test"
>>>> .order="lname"
>>>> .alias="custs"
>>>> endwith
>>>> endfunc
>>>>enddefine
>>>>
>>>>define class cc as cursor
>>>> function getdata
>>>> wait window 'Testing...'+custs.cust+':'+custs.lname
>>>> skip
>>>> wait window 'Testing...'+custs.cust+':'+custs.lname
>>>> endfunc
>>>>enddefine
>
>Terry,
>
>Your code does autoopen the tables, but at the time the autoopen occurs, during creation of the object, there are no table to open in the DE. After the autoopen occurs you are then adding the cursors to the DE. You need to call teh Opentables from the dd.Init as the last call in the with/endwith construct, like so;
>
>
>  function init
>    this.addobject('oc','cc')
>    with this.oc
>      .cursorsource="custs"
>      .database="test"
>      .order="lname"
>      .alias="custs"
>      .OpenTables()
>    endwith
>
Good catch, Jim. THe spirit was right but the posted code will break- OpenTables belongs to the DE, and not the cursor, so the call should go outside the WITH/ENDWITH and say THIS.OpenTables().
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform