Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Database directory location hard coded into form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00276472
Message ID:
00276662
Vues:
21
VFP forms store the path to the tables used in the dataenvironment. Unfortunately when you deploy an application, your forms may point back to your development directory. These paths should be reset at runtime to ensure they are pointing to the proper tables.

* in your main startup PRG determine the current directory
* store in global vars or application object
gcAppPath = sys(2003)
gcDBPath = alltrim(gcAppPath)+"\data\"
gcDBName = "mydatabase.dbc"

*modify your form base class to contain the following in the load method (or change each form).
*also modify your form dataenvironment so make AutoOpenTables=.F.

* point all the tables to the right directory
thisform.SetAll("Database",gcDbPath+gcDbname,"Cursor")
* open the tables
thisform.dataenvironment.opentables()

*NOTE: the above works with tables in a database, the code should be modified if you use free tables.


>I've developed an application and when I install it I've found that the directory location is somehow hard coded into the data environment in the form.
>
>Example, development directory is k:\launcher\source and the database property of the data environment of the form is k:\launcher\source\accounts.dbf. This can not be changed (in italics). I want my app to look for the database in the same directory that the program resides, not "k:\launcher\source\". So if I install it in c:\program files\launcher\, it should not still be looking on the K drive for data.
>
>Is there an easy way to avoid this? What's going on?
>
>Thanks!
>Marvin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform