Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I change file locations?
Message
De
08/04/1997 13:50:52
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de projet
Divers
Thread ID:
00027435
Message ID:
00027449
Vues:
29
>>>Hello all,
>>>
>>>I'm developing VFP5 apps on a Novell Network and have set up a development/test environment on one volume (G:) and set up the live environment on another (I:). I do this because many of the apps will use the same databases and tables and I don't want to work with live data while developing.
>>>
>>>My project, database, forms, menus, etc are located on G:. When I create the EXE on G:, no problem. When I create the EXE on I:, it doesn't know where to find the data. How do I make it use the data on I:?
>>>
>>>Thanx
>>>
>>>Colin Magee
>>
>>You have to store database path in some place (I like config.dbf table placed in the same folder as exe file). Surely, your app may contain configuration form where user can change this value.
>
> I'm not sure of what you mean or how to do it. Here's a few specifics to outline my problem more. The project, forms and th EXE are in G:\SOURCE\TRAINING and the data is in G:\DATA\TRAINING. In the live version the EXE is created in I:\RUNTIME\TRAINING and the data is in I:\DATA\TRAINING. My app starts fine but when I try to open the first form I get the following error: "Error instantiating cursor object. Cannot find i:\runtime\training\training.dbc." How do I make it look in I:\DATA\TRAINING? I've included this directory in the SET PATH TO of the config.fpw.
>
>Thanx
>
>Colin Magee

My approach is following:
1. Table Config.dbf contains some valuable information, including path to dbc file (e.g. 'datapath' field). This table located in 'default' folder (where exe file is).
2. In the first app module (e.g. Start.prg) I open Config.dbf and then OPEN DATABASE (LOCFILE(....)) using Config.datapath as part of database name. So, user either opens dbc immediately, or browses to get new location.
3. DBC() function returns database path/name and this value stored in some app property (e.g. oApp.datapathname).
4. Whenever you open DataEnvironment (in BeforeOpenTables event) I reset Database properties for all Cursors ,so only 'real' (not development) tables will be opened. This operation can be performed by some oApp method.
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform