Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSessions and the control thereof
Message
From
22/05/2009 12:26:19
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01401547
Message ID:
01401560
Views:
37
This is code that I inherited - I've never had to play with datasessions before, I've always let VFP handle it and have never known VFP to get lost in the datasession cloverleaf - so I got nothing here.


>Hi Dorris,
>
>Why do you need playing with data sessions at all? If you need to do some special code in a separate session, create a session based class to do your processing.
>
>>Hello Gentle Peoples
>>
>>Got an error cropping up from a form "DataSession is not valid" and it's occuring out of the following code that runs on refresh of the toolbar
>>
>>
>>*-- Override the parent class method so that it returns
>>*-- .F. when the lAllowDelete property doesn't exist.
>>
>>LOCAL llRetVal, lnThisDataSession, lcAlias
>>
>>llRetVal = .F.
>>IF TYPE("_screen.ActiveForm.lAllowDelete") <> "U" 
>>
>>** llRetVal is set to .T. here
>>
>>  llRetVal = _screen.ActiveForm.lAllowDelete AND ;
>>      NOT _SCREEN.ActiveForm.lReadOnly
>>ENDIF
>>
>>IF llRetVal
>>  lnThisDataSession = SET('DATASESSION')
>>  =messagebox("In allowdelete, lnThisDatasession is " + str(lnThisDataSession))
>>  SET DATASESSION TO _screen.ActiveForm.DataSessionID
>>  =messagebox("In allowdelete, Datasession set to " + str(SET('DATASESSION')))
>>
>>  IF TYPE("_screen.ActiveForm.oBizObj") == "O" AND ;
>>      !ISNULL(_screen.ActiveForm.oBizObj)
>>    *-- Get the alias for the primary business object on
>>    *-- the active form
>>    lcAlias = _screen.ActiveForm.oBizObj.GetAlias()
>>  ELSE
>>    *-- Use the current alias
>>    lcAlias = ALIAS()
>>  ENDIF
>>
>>  *-- The intention is to disable the delete option if the user
>>  *-- is currently adding a new record.
>>  IF !EMPTY(lcAlias) 
>>    llRetVal = !IsAdding(lcAlias)
>>  ENDIF
>>  =messagebox("Exiting allowdelete, Datasession set back to " + str(lnThisDataSession))
>>  SET DATASESSION TO lnThisDataSession        && Errors on this Line
>>ENDIF
>>
>>RETURN llRetVal
>>
>>
>>
>>The form moves/copies patients between caregivers and when moving one client, everything works fine. It's when there are multiple 'uses' that this error comes up.
>>
>>From the messageboxes I've got the following:
>>
>>Entering:  1
>>               6
>>               1
>>1st move/copy
>>               1
>>               6
>>               1
>>2nd
>>               6
>>               6
>>               6
>>Exit form
>>               6
>>               5
>>               6
>>
>>
>>Is there some reason to be setting/resetting datasession?
>>Can I simply 'set' the original value to 1 and not kill anything?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Reply
Map
View

Click here to load this message in the networking platform