Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic path to database 1

Status
Not open for further replies.

spoondyke

Programmer
Nov 26, 2001
19
0
0
GB
is there a way to configure a dynamic path to a database?

the reason for wanting to do this is so that when a user installs my program they can set up the path to the db themselves, instead of me forcing the installation to a predifined directory.

thanks for any help
 
hi,

the most simple way to achieve this is the next one.
instead of using an alias in the BDE, you use in the alias a map something like 'c:\prog\data'. This is done in the property of the ttable.

table1.databasename := 'c:\prog\data';

Thats what has to be done. To make it dynamic you can use an Topendialog to let the user pick a map. and put the result in the property of the ttable.

if OpenDialog1.Execute then
Table1.DatabaseName := ExtractFileDir(OpenDialog1.FileName);


if you store the data always directly underneath a map where the program resists the you can use the next possibility.

The program is in c:\prog and the data is in c:\prog\data

Table1.DatabaseName := ExtractFilePath(Application.ExeName) + 'data\';


Steph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top