Ah yes, you are correct. However the the Open returns the following error: "Query: Cannot open a non-select statement"
I also have found some more help in the Lazarus wiki which just happens to have an example of how to do a "show tables". So then, I tried the following: FormMyDB.Query.SQL.Clear; FormMyDB.Query.SQL.Text := 'show tables'; try FormMyDB.Query.Open; if FormMyDB.Query.EOF then ShowMessage ('There are no tables!'); while not FormMyDB.Query.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 Again however the Open returned the same error. Could the problem be that this is supported through a MySQLConnection, but not an ODBC connection? Dave. On Mon, 2009-01-12 at 09:41 -0800, ABorka wrote: > 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@lists.freepascal.org > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal