Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Production and Development Environments
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00211944
Message ID:
00211951
Vues:
41
>>>Is it possible to set the data environment in a form (or report) so that if it is run in production, it accesses the dbc on production server but if it is run in development, it access the dbc on development box?
>>>
>>>In this particular case, dbc and all dbf names are identical. The only difference is the path to the dbc. I have tried to do this, but for some reason the data environment remembers that it got itself from development path and I can't seem to be able to re-direct it. I'm probably not doing something really simple right, but it has me stumped!
>>>
>>>Appreciate any help. - Susan
>>
>>Susan,
>>
>>There is a chapter in the Effective Techniques book that builds a from class that can do what you want.
>>
>>Basically, what you need to do is in the form's Load make sure that the tables are closed by calling the ThisForm.DataEnvironment.CloseTables(). Then you can get a list of the DE's members with AMEMBERS(). You then loop through the members and for the Cursor baseclass you set the Database property to point where you want. Finally, you call the DE's OpenTables() method.
>
>
>Jim,
>
>Couldn't the same results be done if she has logic in the DataEnvironment.BeforeOpenTables() event that pre-cycles through the objects (tables/views) and changes the path property before it even has a chance to open the tables?
>
>This would prevent the need of closing/scanning/ and then re-opening the tables.

PMFJI- you're right, but since you can't easily subclass the DE, this code would have to be placed in every form. A good compromise: set the DE AutoOpenTables property to .F., put the code in the form's load, and call DE.OpenTables when you're done.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform