?
Solved

Simple question about using BDE and Alias

Posted on 2003-03-20
7
Medium Priority
?
174 Views
Last Modified: 2010-04-04
I've set up 3 Aliases but everytime I change computers the alias resets so I get errors when I try to run the program. I can get them working by setting up new Aliases before I work with my program. This is getting tiresome. Is there anyway I can make an Alias which sticks?
0
Comment
Question by:West3366
[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
  • 2
7 Comments
 
LVL 9

Expert Comment

by:mocarts
ID: 8174338
one way - you can copy idapi*.cfg from your old computer BDE directory to the new one.
another way is to create aliases in your prograam by using BDE unit (dbiAddAlias function - see BDE32.hlp file for more info and examples)

wbr, mo
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8174351
if u use dbase or paradox,
then u cane simple use the path,
where the table are, as alias

so the question is
what database do u use?

btw. you can also create aliases
on the fly at runtime

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8174361
btw. you must not go through the bde-api,
for creating an alias

tsession provides methods for this

meikl ;-)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:West3366
ID: 8174460
I'm using Dbase. And creating Aliases at run time is probably the solution I would use. How would I set it up?
0
 

Author Comment

by:West3366
ID: 8174533
I'm using Dbase. And creating Aliases at run time is probably the solution I would use. How would I set it up?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8175274
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 300 total points
ID: 8175366
and a sample using the default session
(includes modify existing and create new)

unit mod_ali_u;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  DBTables, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    BT_Modify: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Session1: TSession;
    ComboBox1: TComboBox;
    Button1: TButton;
    procedure BT_ModifyClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.BT_ModifyClick(Sender: TObject);
begin
  If ComboBox1.Text <> '' then  //Alias selected
  begin
    session1.ModifyAlias(ComboBox1.Text,listbox1.items); //Perform changes
    session1.saveconfigfile;                             //Saveconfig
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ComboBox1.text := '';
//  session1.ConfigMode := [cfmPersistent];    //Configuartion only configfile
//  Session1.GetAliasNames(ComboBox1.Items);   // Get all Aliases
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  session1.GetAliasParams(ComboBox1.Text,listbox1.items);  //Get params from selected Alais
end;

//get current alias param
procedure TForm1.ListBox1Click(Sender: TObject);
begin
  edit1.text := listbox1.Items.Values[listbox1.Items.Names[ListBox1.ItemIndex]]; //Edit selected Param
end;

//modify selected alias param
procedure TForm1.Button2Click(Sender: TObject);
begin
  listbox1.Items.Values[listbox1.Items.Names[ListBox1.ItemIndex]] := edit1.text;  //Update List with editentry
end;

//Create
procedure TForm1.Button1Click(Sender: TObject);
begin
  session1.ConfigMode := [cfmPersistent];    //Configuartion only configfile
  session1.AddStandardAlias('MyNewAlias','C:\TEMP','PARADOX');  //Add New Paradox Alias
  session1.saveconfigfile;                             //Saveconfig
end;

end.


meikl ;-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

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