Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form's datasession is not released
Message
De
31/03/2002 07:15:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00639028
Message ID:
00639261
Vues:
27
>>>Hi everybody,
>>>
>>>This is in my colleague's application: there is a class called Update, which is instantiated in the main program of the application.
>>>
>>>Here is the top of its Init method:
>>>
>>>LPARAMETER tcDBC
>>>*--- This is the initialization method for this class ...
>>>
>>>*--- DNG 5/9/2000: Store database to object property.
>>>*--- NOTE: All update related functions should reference oupdate.curdbc instead of ojc.curdbc.
>>>*----------01/29/02 add these settings here:
>>>SET DELE ON
>>>SET TALK OFF
>>>SET SAFETY OFF
>>>SET EXACT ON
>>>THIS.curdbc = m.tcDBC
>>>*--- Start statistics form.
>>>PUBLIC oMatchStats
>>>DO FORM matchstats NAME oMatchStats LINKED NOSHOW
>>>SET DATASESSION TO oMatchStats.DATASESSIONID
>>>THIS.pDataSession = oMatchStats.DATASESSIONID
>>>*--- DNG 6/28/2001: Default pnpostdatasession.
>>>THIS.pnPostDataSession = THIS.pDataSession
>>>
>>>SET MULTILOCKS ON	&& For buffering for this new datasession.
>>>
>>>Here is Destroy method of this class:
>>>IF VARTYPE(opost) = "O"
>>>   release opost
>>>endif
>>>close databases all
>>>*!*	=closeallbasetables(SET('DATASESSION'))
>>>*!*	if used('postcursor')
>>>*!*	use in postcursor
>>>*!*	endif
>>>*!*	if used('matchedprops')
>>>*!*	use in matchedprops
>>>*!*	endif
>>>*!*	if used('ltstatstemp')
>>>*!*	use in ltstatstemp
>>>*!*	endif
>>>*!*	if used('towns')
>>>*!*	use in towns
>>>*!*	endif
>>>*!*	omatchstats.release()
>>>*!*	omatchstats=null
>>>*!*	release omatchstats
>>>
>>>dodefault()
>>>
>>>The matchstats form has no code at all and it has couple of textboxes with
>>>oUpdate.Someproperty as a controlsource...
>>>
>>>When the application is finished, it still has "Unknown(2)" session, which is empty.
>>>
>>>Can you see, what could be the problem here and why this DS remains opened?
>>>
>>>Thanks in advance.
>>
>>Nadya,
>>
>>The init makes a public variable oMatchStats
>>then in the init: DO FORM matchstats NAME oMatchStats LINKED NOSHOW
>>
>>If you add: Release oMatchStats to the Destroy of the class it will work (or uncomment the last commented line in the Destroy method)
>
>We tried it, but it didn't work. The session is still alive.
>

I have created a Class with the init and destroy code you have provided.
I also made a form matchstats with a private datasession
Releasing oMatchStats in the destroy made the datasession go away.

I guess it must be something else

>However, I got one idea on the way home. Why at all we need a separate custom Update class calling this form by this way. Why the form itself could not be an Update class. We can make it invisible for several parameters... It seems, like a good and simple approach to me, but I haven't decided yet, would I code it myself and give her the final result or just give this idea to her to code...

Seems like a good idea. The form must not necessarily be a class. Just launch it: do form MatchStats.
It will be there until you quit vfp
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform