[fpc-pascal] SQL show tables
David B Copeland
david.copeland at jsidata.ca
Mon Jan 12 18:05:42 CET 2009
Hi,
I am trying to pre-fill a TComboBox with the all the tables in a
database, without sucess. I am running Suse 10.3, a recent (within a
week) Lazarus 0.9.27 from svn, FPC 2.2.2, 64-bit. The program uses a
ODBCConnection to a MySQL database.
The code I tried is:
FormMyDB.Query.SQL.Clear;
FormMyDB.Query.SQL.Add ('show tables;');
try
FormMyDB.Query.ExecSQL;
if FormMyDB.Datasource.DataSet.EOF then
ShowMessage ('There are no tables!'); // This gets displayed
while not FormMyDB.Datasource.DataSet.EOF do begin
CBTable.Items.Add
(FormMyDB.Datasource.DataSet.FieldByName('Tables_in_TRACKER').AsString);
FormMyDB.Datasource.DataSet.Next
end;
FormMyDB.Query.Close;
except on e: exception do begin
ShowMessage ('Error load table names: ' + e.message);
exit;
end
end
The ExecSQL appears to complete normally, but the result dataset is
empty. What am I doing wrong? In other parts of the program I
successfully both query and update various tables in the database. Any
pointers in the right direction will be greatly appreciated.
Dave Copeland.
More information about the fpc-pascal
mailing list