?
Solved

specifing a path for a database alias

Posted on 2000-05-11
4
Medium Priority
?
293 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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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…
Suggested Courses

762 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