• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Simple question about using BDE and Alias

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
West3366
Asked:
West3366
  • 4
  • 2
1 Solution
 
mocartsCommented:
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
 
kretzschmarCommented:
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
 
kretzschmarCommented:
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.

 
West3366Author Commented:
I'm using Dbase. And creating Aliases at run time is probably the solution I would use. How would I set it up?
0
 
West3366Author Commented:
I'm using Dbase. And creating Aliases at run time is probably the solution I would use. How would I set it up?
0
 
kretzschmarCommented:
0
 
kretzschmarCommented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now