Get directory from BDE-alias

Posted in Databases

You can use GetAliasParams method of TSession: Session.GetAliasParams(AliasName, StringList) or DbiGetDatabaseDesc of DBIProcs:

uses  DBIProcs, DBITypes;
...
procedure TForm1.Button2Click(Sender: TObject);
var
  StringList: TStringList;
  DbDes: DBDesc;
begin
  StringList:=TStringList.Create;
  try
    Check(DbiGetDatabaseDesc(PChar(AliasName2.Text), @DbDes));
    with DbDes do
    begin
      StringList.Add('Driver Name: '+szDbType);
      StringList.Add('AliasName: '+szName);
      StringList.Add('Text: '+szText);
      StringList.Add('Physical Name/Path: '+szPhyName);
    end;
    ListBox2.Items:=StringList;
  finally
    StringList.Free;
  end;
end;