Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data environment gotcha?
Message
De
27/09/2001 20:57:24
 
 
À
27/09/2001 18:25:57
Mike Herguth
Herguth Laboratories, Inc.
Vallejo, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00561731
Message ID:
00561777
Vues:
32
>I am ready to launch a large project in VFP and find that the tables and views in the forms data environment are bound to the development tables and there is no way to point the forms to the live data when it resides elsewhere, even if it is in the path and has the same directory names, etc. What gives? There must be an easier way. Thanks in advance for any help you can give!

Hiya!! Just thought to tell you I had a simliar pain... compounded by the SysAdmin (me) travelling all over the country and using different servers to get accesss. So, I created a user level id on the boot up of my name when I entered the system. It asks me how I want to access the data 1=local, 2=network, 3=direct to server, 4=direct to test data. This is stored to the oApp.nPathSet. Then, in the beforeopentables of a form dataenvironment... you get this....

* dataenvironment.beforeopentables

* only needed if we are in the actual system
IF !(TYPE("OApp")=="O")
RETURN
ENDIF
* Set the data directory
LOCAL lcPathSet, lnCount, lcDatabase
DO CASE
CASE oApp.nPathSet = 1
lcPathSet = "C:\My Documents\Data\"
CASE oApp.nPathSet = 2
lcPathSet = "Z:\My Documents\Data\"
CASE oApp.nPathSet = 3
lcPathSet = "E:\LiSA\"
CASE oApp.nPathSet = 4
lcPathSet = "G:\LiSA\"
ENDCASE
* Get list of members of the DataEnvironment
lnObjects = AMEMBERS(laObjects, THIS, 2)
* Look at each member object, but only process cursors.
FOR lnCount = 1 TO lnObjects
loObject = EVALUATE('THIS.' + laObjects[lnCount])
IF UPPER(loObject.BaseClass) = 'CURSOR'
lcDatabase = loObject.Database
* If this is a free table, we can leave it. Else....
IF !EMPTY(lcDatabase)
loObject.Database = lcPathSet + SUBSTR(lcDatabase, RAT('\', lcDatabase) + 1)
ENDIF EMPTY(lcDatabase)
ENDIF UPPER(loObject.BaseClass) = 'CURSOR'
NEXT lnCount

I hope this helps... it certainly makes all of my testing, etc.. easier as I can access test data anywhere.... (help was garnered by D. Hennig on this... I am not THAT clever - yet)....

Ric
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform