Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a Private Datasession for Procedures
Message
From
13/01/2005 12:34:46
 
 
To
13/01/2005 12:16:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00976830
Message ID:
00976838
Views:
8
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
Previous
Reply
Map
View

Click here to load this message in the networking platform