Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

specifing a path for a database alias

Posted on 2000-05-11
4
Medium Priority
?
294 Views
Last Modified: 2012-05-04
Thankyou for your answer.
I am using Delphi pro 5.
I have created an alias to an Access database using the driver MSACCESS. It presently has a fixed path to a directory on the C drive.
How can I specify a varying path so that the user can choose where they would like to install the database and other files.
For example they may wish to put the database on their D drive.
Thankyou,
Ivan
0
Comment
Question by:icarey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 2799831
It's easy just look at this Delphi topic.

--------- TSession ------
Adds or changes parameters for a Borland Database Engine (BDE) alias.

procedure ModifyAlias(Name: String; List: TStrings);

Description

Call ModifyAlias to change the parameters for a specified BDE alias. Name is the name of the alias to modify. List is a string list object previously populated with parameter values to add or change. An application must create and maintain List.

Populate List with parameter strings before calling ModifyAlias. List need only contain the parameters to change. If ModifyAlias passes a parameter for which a value already exists, the new parameter replaces the existing one. New parameters that are not yet defined for the alias are added to the existing parameters. If List is empty, ModifyAlias does not change any existing parameters.
--------


There is a sample how to change alias path.

----
Igor
0
 
LVL 2

Accepted Solution

by:
IPCH earned 300 total points
ID: 2824772
If you want sample:

var
  MyList: TStringList;
begin
  MyList := TStringList.Create;
  try
    MyList.Add('TYPE=MSACCESS');
    MyList.Add('DATABASE NAME=:E:\Data\Stam.MDB');
    If Session.IsAlias('Ivan')
    Then Session.ModifyAlias('Ivan', MyList)
    Else Session.AddAlias('Ivan', 'MSACCESS', MyList);
  finally
    MyList.Free;
  end;
end.

Regards
Ivan
0
 
LVL 4

Expert Comment

by:Radler
ID: 2835377
Hi icarey,

My contribuition:

Because historical reason I don't use access, but the engine is seemless.
If want make use of Transactions( today is very frequent ) you'll need a TDatabase at you DataModule.
Using a TDabase to manager your Dataset's make you app more realible.
So put a TDatabase and give it a DatabaseName like "icarey_fly_alias"
set all Dataset to use this new alias and your datamodule create code put

TDatabase1.Connected:=False; //dataset must be closed here
TDatabase1.Directory:="MyTablesDirectory";
TDatabase1.Connected:=True;
//Open you dataset's here
.....

T++, Radler.
0
 
LVL 3

Author Comment

by:icarey
ID: 2843923
Answer accepted
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question