Solved

Creating Aliases using Code instead of the BDE Config - Urgent

Posted on 1998-06-15
3
196 Views
Last Modified: 2010-04-04
Hello,

Can anyone tell me how or point me towards some information on the creation of BDE aliases using code? I am using Delphi 1.0 w/ BDE 2.5 (16 Bit) (a must).

I am new to Delphi programming, so a code sample would be most helpful and most appreciated.

Thanks.

Jose Negron
Jose_Negron@dtc.org
0
Comment
Question by:jnegron
3 Comments
 
LVL 1

Accepted Solution

by:
Marcius earned 50 total points
ID: 1352887
Hi Jose,

You need to use the BDE API function AddAlias.

function DbiAddAlias (hCfg: hDBICfg; pszAliasName: PChar; pszDriverType: PChar; pszParams: PChar; bPersist: Bool): DBIResult stdcall;

This is a nasty looking function call, so I will try to give an example which makes it easier to understand. For further information, you need to look in the BDE API help file and search for the AddAlias function.


1. Add the following units to your uses clause:

uses DB, DbiProcs;

2. Add a procedure like this:

procedure AddMyAlias(AliasName, AliasPath: String);
begin  
  // Check takes a DbiResult and determines if there is an error
  Check(dbiInit(Nil));  // Require in order to use DbiAddAlias
  Check(DbiAddAlias(Nil, PChar(AliasName), Nil,
        PChar(AliasPath), True));
end;

3. Call the function like this:

AddMyAlias('TestAlias','PATH:C:\MYPATH');


0
 
LVL 1

Expert Comment

by:Greedy
ID: 1352888
0
 

Author Comment

by:jnegron
ID: 1352889
Thanks..
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy file in dll not working but working on exe ! 18 92
Communication Between RC4 Delphi <-> PHP 3 113
Delphi - replicating a form 8 72
Tvertscrollbox like a whatsapp layout 5 26
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

808 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