The example below fetches a list of all tables in an ADO data store. It then traverses this list, making an entry in another table with each table’s name and number of records.
procedure TForm1.Button1Click(Sender: TObject);
var
SL: TStrings;
index: Integer;
begin
SL := TStringList.Create;
try
ADOConnection1.GetTableNames(SL, False);
for index := 0 to (SL.Count - 1) do begin
Table1.Insert;
Table1.FieldByName('Name').AsString := SL[index];
if ADOTable1.Active then ADOTable1.Close;
ADOTable1.TableName := SL[index];
ADOTable1.Open;
Table1.FieldByName('Records').AsInteger := ADOTable1.RecordCount;
Table1.Post;
end;
finally
SL.Free;
ADOTable1.Close;
end;
end;
?