Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing the Location of Tables
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00271934
Message ID:
00272066
Vues:
27
Where are you calling the code from? You'll get this message if this code runs after the cursors in the DE are open. You need to call this method from Form.load or Form.DataEnvironment.BeforeOpenTables.

>Thanks Erik, that worked form me. I'm not sure I understand all that is going on in this code, but I plan to study it.
>
>BTW is there a way to prevent the message "Property setting will not take effect until environment reloaded"? It displays once for every table in the database.
>
>>
>>This path information is stored in properties of cursor objects in the dataenvironment. The common way to handle this is with a routine that runs before thetables are opened, that loops through the cursors in the DE, and changes the database property depending on some current setting: a registry entry, a public variable, form property, etc. My framework has a ChangeDataPath routine that is called from the form.load that does this.
>>
>>
>>LPARA tcNewDataPath
>>
>>LOCAL lnCnt, loObj, lcDBC, lcNewDataPath
>>
>>IF TYPE("tcNewDataPath") <> "C"
>>	RETURN .F.
>>ELSE
>>	lcNewDataPath = tcNewDataPath
>>ENDIF
>>
>>LOCAL ARRAY laList[1]
>>
>>*** Get Object Members of DE
>>=AMEMBERS(laList, THISFORM.DATAENVIRONMENT, 2)
>>IF EMPTY(laList[1])
>>	*** Nothing in DE
>>	RETURN
>>ENDIF
>>
>>IF ALEN( laList,1 ) > 0
>>	FOR i = 1 TO ALEN(laList,1 )
>>		loObj =  EVAL("ThisForm.DataEnvironment."+laList[i])
>>		IF LOWER(loObj.BASECLASS ) = 'cursor' AND "\"$loObj.DATABASE
>>			IF !EMPTY(loObj.DATABASE)
>>				*** Contained Table
>>				lcDBC = SUBSTR(loObj.DATABASE, RAT('\', loObj.DATABASE))
>>				loObj.DATABASE = tcNewDataPath + lcDBC
>>				IF !DBUSED(loObj.Database)
>>					OPEN DATABASE (loObj.Database)
>>				ENDIF
>>				SET DATABASE TO (loObj.Database)
>>			ELSE
>>				*** Free Table
>>				lcDBC = SUBSTR( loObj.CursorSouce, RAT('\',loObj.CursorSouce))
>>				loObj.CursorSouce = tcNewDataPath + lcDBC
>>			ENDIF
>>		ENDIF
>>	NEXT
>>ENDIF
>>
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform