[fpc-pascal] SQL show tables
ABorka
fpc-devel at aborka.com
Mon Jan 12 18:41:00 CET 2009
I think "execsql" never returns any records, you supposed to use "open"
for queries returning results.
Execsql is for insert, delete, update, etc.
David B Copeland wrote:
> 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.
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
More information about the fpc-pascal
mailing list