Search code examples
databasedelphibde

Working with multiple database types


I'm currently building a program that primarily uses ABSDatabase, however I am trying to return the alias list from a BDE configuration, I'm currently using the following code:

  Session.GetDatabaseNames(gvAliasList);
  Session.GetTableNames(gvAliasList[0], gvTableList);

This will only bring back the database name for the ABSDatabase set, how can I make it return the BDE alias'?

Thanks.


Solution

  • You can retrieve all BDE aliases by using this code:

    uses DBTables;
    
    procedure LoadAliases();
    var
      CurrentAliases: TStringList;
    begin
      CurrentAliases := TStringList.Create;
      try
        Session.GetAliasNames(CurrentAliases);
        ComboBox1.Items:= CurrentAliases;
      finally
        CurrentAliases.Free;
      end;
    end;
    

    Remember that BDE is deprecated by Embarcadero and not actively developed since many years ago. Try to migrate to a more current database access library like DBX.