Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When does datasession change ?
Message
From
21/06/2001 05:44:34
 
 
To
20/06/2001 15:09:34
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00521629
Message ID:
00521795
Views:
16
>Hi All,
>
>I met some ackward situation calling and returning between forms.
>Let me explain and wish someone set me free from whole day debugging.
>
>1.open a LOOKUP-form(ex. order list by date)
>. modeless and private datasession..based on parameterised view
>. opened at datasession 2 ...hide himself on calling other form
>2.call input form(ex. order input form) according to selected PK value
>. modeless and private datasession (opened at datasession '3')
>. 2 updatable views are used and invokes hidden called form on UNLOAD after
>. data input or correction.
>
>When 2nd form is released, Datasession has not been changed..it still says
>datasession '3' and fires calling form's activate event and after unloading
>itself, finally datasession has set to calling form's datasession '2'.
>
>The problem is when I call 2nd form again, Datasession set to '4' as if
>last form has not been destroyed and VFP holted on 2nd form's activate saying
>'Fatal Error...',I guess, some trouble in datasession.
>
>To make me crazy, other kind of forms nearly same behavior with same parent
>class as above runs fine, in which datasession once returned to default('1')
>on 2nd forms' release event and set to 1st form's datasession('2'), and when i
>call 2nd form again, it's datasession starts from '3' normally.
>There is no overwritten code at release event but i don't know why one form
>behaves wrongly , others run fine.
>
>Any advice would be highly appreciated.
>
>RGDS
>HK.Lee

Hi,
have You checked if your second form is relased?
Look at the datasession window. It will list all used datasession in the combobox. If there are 3 sessions it means the 2nd form is in memory.

The fire of release event means not that the form will release.

Look at this example
LOCAL;
 loForm1,;
 loForm2
 
 loForm1 = CREATEOBJECT('MyForm')
 loForm2 = loForm1
 loForm1.RELEASE()
 
 ?loForm2.NAME
 
 
 * or (also fine)
LOCAL;
 loForm1
 
 loForm1 = CREATEOBJECT('MyForm')
 WITH loForm1
 .RELEASE()
 ?.NAME	      &&no error
 ENDWITH &&loForm1
?loForm1.NAME && error
So you need to clean up all pointer to your form then release.
Like
LOCAL;
 loForm1,;
 loForm2
 
 loForm1 = CREATEOBJECT('MyForm')
 loForm2 = loForm1
 ?loForm2.NAME
 loForm2 = .NULL.

 loForm1.RELEASE()
 
 
Do not reference on numerical constants for the datasession.
The Datasession of a Form is simple in THISFORM.DataSessionID

Also look at Documentation for SET DATASESSION Point REMARKS. There is something about "do not use this command within a running form" or so.

Lutz
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform