I´m using Delphi 1 to maintain some old applications. These applications not
uses TDatabase for connect to database server. Each TTable or TQuery
existing on applications uses a BDE Alias on DatabaseName property and this
BDE Alias points to a database server. Well now the database server name can
be selected from a list by user and I need change the BDE Alias´ ServerName
parameter before open any TQuery or TTable for connect to correct database
server.
How can I do this ?
PS. This is not my desire but unfortunately include TDatabase component in
applications is out of question.
Thanks in advance
Jerry
> How can I do this ?
>
You could use the Components property of your form, something like:
procedure TForm1.SetDBName(ADBName: string);
var i: integer;
begin
for i := 0 to ComponentCount - 1 do begin
if Components[i] is TQuery then TQuery(Components[i]).DatabaseName :=
ADBName;
// then TTable...
end;
end;
I don't have D1 installed to test this.
HTH,
Jim
Wouldn't a TDatabase solve the problem? Just curious, why is it out of
the question?
krf
Jerry Adriane Gonçalves <je...@tqi.com.br> wrote in message
news:3c3d8b5f_1@dnews...
priviate
FDatabseName :String;
procedure SetDBName(const value :String);
public
property DatabaseName :String read FDatabaseName write SetDBName;
end;
So now whenever you create the form/datamodule
{create of the form/datamodule}
MyFormOrDataModule.DatabaseName := Database1.DatabaseName; {or however you
fetch the alias name}
krf
Jim Elden <x@yz> wrote in message news:3c3d9417_1@dnews...
-Jim
"Kevin Frevert" <kfre...@midwayusa.com> wrote in message
news:3c3d9e15$1_2@dnews...