Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem moving from mapped drives to UNC
Message
From
21/05/1998 17:02:02
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00100857
Message ID:
00100968
Views:
52
>>>>>>I am attempting to run my VFP application (as an EXE file) from a remote site using universal naming convention instead of a mapped drive. (Note the application works perfectly with a mapped drive).
>
>>Would this work:
>>
>>set default to \\FS_RENAL2\USER1\APPS\DB\MAIN
>>use database\atable.dbf
>>use database\another.dbf
>>use database\thisone.dbf
>
>Hi Bob. I don't want to hard-code the server and directory into the application. Any other ideas?

The above was just to get rid of the error you reported. Now that we have an approach that works (I assume you are confirming that the above works), we can put this UNC name into a table or into an ini file, and read it at startup. For example:

If your program is MyProg.exe you could create MyProg.dbf (I prefer the same name to remind me that they're a matched set) with two fields cDefault, and cPath. MyProg.cDefault is "\\FS_RENAL2\USER1\APPS\DB\MAIN" without the quotes, and MyProg.cPath is "DataBase;Help;Reports" for example (and again without the quotes.

In your Main.prg, or whatever, some code near the begining will be:

use MyProg && which is in the same directory as the exe file
gcDirectory = alltrim(MyProg.cDefault)
set default to &gcDirectory
gcPath = alltrim(MyProg.cPath)
set path to &gcPath
use

With the (optional) set path from above you can load your data with:
use atable.dbf

Without the set path you could continue to use:
use database\atable.dbf

An ini file would be a better place to keep your folder addresses (users can edit them easier), but the dbf approach works and is easier to describe (its the thought that counts).
Bob
Previous
Reply
Map
View

Click here to load this message in the networking platform