Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Switching DataSession's
Message
De
12/12/2004 16:48:16
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Switching DataSession's
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00968641
Message ID:
00968641
Vues:
43
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!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform