Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't get Session class to close
Message
 
 
À
07/06/2002 13:40:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00665555
Message ID:
00666085
Vues:
20
Weird. I use this construction in bunch of my applications and it works just fine. However, I never created a session object from the form. I always created it in main program in case, I don't use form (Auto process). This technique ensure, that all tables would be opened in private DS, and not in calling form DS.

>Hi Nadya,
>NewObject doesn't create a separate datasession, it just uses the same datasession as the form.
>
>>Don't use your construct, e.g. ds.prg
>>
>>Do explicitly in your code (what's the purpose of doing it in form?):
>>
>>loDS=newobject('MySessionClass','MySessionClass.prg')
>>...
>>
>>release loDS.
>>
>>
>>
>>
>>>I have this code:
>>>
>>>DS.PRG
>>>Return CreateObject('DS')
>>>
>>>Define Class DS as Session
>>>  Procedure Init()
>>>    ..... Open Some Files
>>>    ..... Set Some Relations and Orders
>>>  EndProc
>>>
>>>  Procedure Destroy()
>>>    Close Tables All   && I put this in just to see if the object was being DESTROYed
>>>                       &&   I know it's not needed.
>>>  EndProc
>>>EndDefine
>>>
>>>SomeForm.Method()
>>>  local lo
>>>  lo = DS()
>>>  Report Form WhatEver
>>>
>>>When lo goes out of scope, the DATASESSION doesn't close, or return to the SomeForm.DATASESSION.
>>>
>>>If I do it from the command window:
>>>go = DS()
>>>Release go
>>>
>>>the DATASESSION created USUALLY releases, but not always.
>>>
>>>TIA
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform