Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create a Private Datasession for Procedures
Message
De
13/01/2005 12:34:46
 
 
À
13/01/2005 12:16:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00976830
Message ID:
00976838
Vues:
7
Breno,

>As I make to create a private Datasession for procedure?

In VFP7 and up (actually VFP6 with one of the later service packs), you can use the Session class to put a private datasession around a procedure. Something like this is one way to do it:
oMyClass = CREATEOBJECT("MyClass")
lReturnVal = oMyClass.MyProc("Testing")
oMyClass = NULL

DEFINE CLASS MyClass AS Session
FUNCTION Init
* put any needed SET commands here
SET DELETED ON
SET TALK OFF
SET EXCLUSIVE OFF
* and so forth - note: the defaults for some
* of these were changed in Session class in later
* versions of VFP
ENDFUNC

FUNCTION MyProc(cParam1 AS String) As Boolean
LOCAL lSuccess
lSuccess = .F.
* your code here that sets value of lSuccess when done
RETURN lSuccess
ENDFUNC

* or you can just use the older syntax with LPARAMETERS:
FUNCTION MyProc2
LPARAMETERS cParam1
LOCAL lSuccess
lSuccess = .F.
* code here
RETURN lSuccess && or return whatever var type you prefer
ENDFUNC
ENDDEFINE
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform