Delphi Examples: DbiOpenTableList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiOpenTableList

Return to chapter overview

Create a table with information about all tables associated with database.

This example retrieves all tables in the databse with the .DB extension and puts the tablenames into a string list object, such as the Lines property of a TMemo. The example uses the following input:

 fDbiOpenTableList(Table1.DBHandle, Memo1.Lines);

 

The procedure is:

procedure fDbiOpenTableList(hTmpDb: hDBIDb; TableList: TStrings);

var

 hCursor : hDBICur;

 ListDesc : TBLBaseDesc;

begin

 Check(DbiOpenTableList(hTmpDb, False, False, '*.DB', hCursor));

 TableList.Clear;

while (DbiGetNextRecord(hCursor, dbiNOLOCK, @ListDesc, nil) = dbiErr_None) do

   TableList.Add(ListDesc.szName);

end;