Delphi Examples: DbiOpenDatabaseList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiOpenDatabaseList

Return to chapter overview

Return a list of of accessible databases and all aliases found in the configuration file.

This example uses the following input:

 fDbiOpenDatabaseList(DatabaseList);

 

The procedure is:

procedure fDbiOpenDatabaseList(DatabaseList: TStringList);

var

 TmpCursor: hDbiCur;

 Database: DBDesc;

 rslt: DbiResult;

begin

 DatabaseList.Clear;

 Check(DbiOpenDatabaseList(TmpCursor));

repeat

   rslt:= DbiGetNextRecord(TmpCursor, dbiNOLOCK, @Database, nil);

  if (rslt <> DBIERR_EOF) then begin

     DatabaseList.Add(StrPas(Database.szName)

       + ' - ' + StrPas(Database.szPhyName)

       +  ' - ' + StrPas(Database.szDbType))

  end;

until (rslt <> DBIERR_NONE);

 Check(DbiCloseCursor(TmpCursor));

end;