Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data environment
Message
De
10/09/1999 16:09:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00263304
Message ID:
00263529
Vues:
22
>>I've developed an application on a network, I do my development work
>>on "p:\development\" and data stor in a subdir of that called
>>data, problem I'm having is when I compile
>>and install the app for a user with the same structure yet different
>>drive say "g:\" with a data subdir the app runs yet prompts
>>the users for location of the database.
>
>Hi Bill.
>
>You need to put some code into your forms so that they point to your live data directory. I do the following
>
>--------------
>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.
>---------------

Hi Evan:

We do pretty much the same in our app using free tables, with pre-defined gcDbfPath memvars, which the user can select (from a different part of the system) to allow working with data from the local drive, local network server, or even remote network server over the WAN... We also re-define the memvars depending on whether we want to point to production or test/training data. After the screen/data environment is set during design, we delete all tables from the DE, then set up the desired tables in the BeforeTableOpen method of the DE, which is where we also set up any special buffering if needed (ie: cursorsetprop...)

So far, it works pretty slick.

Rob
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform