Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Switching DataSession's
Message
De
13/12/2004 12:53:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
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:
00968818
Vues:
5
>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!


Gunnar,
Sorry couldn't read the whole thread and don't know if you already checked this. The macro substition there looks like as the culprit. Set datasession doesn't error with macro substition even if it was something erroneous ie: DummyVariable is not defined and:
set datasession to &DummyVariable
doesn't error and doesn't do anything (as if you did "set datasession to")
if Type("_screen.ActiveForm") = "O"
	CurrentDS	= set("datasession")
	CallingFormDS	= _screen.ActiveForm.DatasessionId
	if CallingFormDS <> CurrentDS
		ResetDS = .t.
		set datasession to CallingFormDS
* or
		set datasession to _screen.ActiveForm.DatasessionId
	endif
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform