Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Private DataSession
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00381943
Message ID:
00382006
Views:
25
>Milford,
>
>Try this ... pass the form as an object, or maybe just its data session id to your UDF that creates the cursor and runs the SQL to populate it, etc. In your UDF, set the current data session (SET DATASESSION TO ) to match what you passed in. Then Create your new cursor and run whatever SQL you need to populate it. When you return from your UDF back to the form (I think you can even "reset" the current data session in the UDF before you "RETURN"), your new cursor should be visible in the form's datasession.
>
>Best wishes,
>Jimmy D.

You definitely need to set the DS back to what it was at the end of the UDF. If you leave the UDF in the private DS of the form, the DS can not be released when the form is destroyed.
procedure myudf
*
lparameter tnDSID
if vartype(tnDSID) <> 'N' or tnDSID < 1
   return
endif
local lnOldDSID
lnOldDSID = set('datasession')
set datasession to (tnDSID)
*
* create your cursor here
*
set datasession to (lnOldDSID)
return
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform