Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Switching DataSession's
Message
De
13/12/2004 01:18:52
Dorin Vasilescu
ALL Trans Romania
Arad, Roumanie
 
 
À
12/12/2004 16:48:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00968641
Message ID:
00968659
Vues:
8
Hi
I've seen that calling a method of an object automatically switch datasession to datasession in which object was created (Default?).
You can add a property to your form class to you store reference to oToolBox at Init(). Then all will take place in form's datasession.

You can call thisform.oToolBox.oGlobalStr.GetLogSeekStr(...)

After I've done this, I didn't need to switch between datasessions any more.


>Hello everybody
>
>Before i start, i know u can switch DS with 'set datasession to' <s>, thats my problem, it's not working as expected.
>
>here is the setup i have:
>
>at app initialization i create an object called 'oToolBox'. this is a class/function container controling the creation and destruction of support functions. at that time this class is empty.
>
>one of my forms started later through menu, has a private datasession. this form now calls a function controlled through the 'oToolBox' like this:
oToolBox.oGlobalStr.GetLogSeekStr(...)
. oToolBox now automaticly creates/attaches an instance of 'oGlobalStr' and executes the method called.
>
>this all works fine, but, since this was called from a form with a private ds, the command
TblName = dbf(AliasName) && the AliasName variable has a valid alias from an open table
does not work. it errors "Alias Not Found".
>
>in the debugger this command executes correctly.
>
>so i added at the begining of my method the following:
>if Type("_screen.ActiveForm.DatasessionId") = "N"
>	CurrentDS		= set("datasession")
>	CallingFormDS	= _screen.ActiveForm.DatasessionId
>	if CallingFormDS <> CurrentDS
>		ResetDS = .t.
>		set datasession to &CallingFormDS
>	endif
>endif
>which also executes all the way through, however the above mentioned command is still throwing the same error. the form in question is active, the table is open with that alias, in the debugger the dbf() shows the correct result - i have no clue, can u not change ds 'on the fly' like this? are there 'easy' alternatives, do i do something wrong?
>
>thanks for all your help in advance!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform