Recent

Author Topic: SQL  (Read 2089 times)

Neville

  • New Member
  • *
  • Posts: 47
SQL
« on: December 27, 2024, 06:03:51 pm »
Using TSQLQuery with Helen Borrie's SQL, The process fails at the line ending 'First'; "Operation cannot be performed on an inactive dataset."
I got no complaint at the ExecSQL line.

What could be the problem?

   FirebirdUtilsForm.FirebirdQuery.SQL.clear;
   FirebirdUtilsForm.FirebirdQuery.SQL.text := 'select rdb$relation_name,rdb$field_name,rdb$constraint_name ' +
                                               'from rdb$relation_constraints rc,rdb$index_segments ri ' +
                                               'where ri.rdb$index_name = rc.rdb$index_name order by rdb$relation_name';
   FirebirdUtilsForm.FirebirdQuery.ExecSQL;
   FirebirdUtilsForm.FirebirdQuery.First;
   while not FirebirdUtilsForm.FirebirdQuery.EOF do
   begin

dsiders

  • Hero Member
  • *****
  • Posts: 1345
Re: SQL
« Reply #1 on: December 27, 2024, 06:32:11 pm »
Using TSQLQuery with Helen Borrie's SQL, The process fails at the line ending 'First'; "Operation cannot be performed on an inactive dataset."
I got no complaint at the ExecSQL line.

What could be the problem?

   FirebirdUtilsForm.FirebirdQuery.SQL.clear;
   FirebirdUtilsForm.FirebirdQuery.SQL.text := 'select rdb$relation_name,rdb$field_name,rdb$constraint_name ' +
                                               'from rdb$relation_constraints rc,rdb$index_segments ri ' +
                                               'where ri.rdb$index_name = rc.rdb$index_name order by rdb$relation_name';
   FirebirdUtilsForm.FirebirdQuery.ExecSQL;
   FirebirdUtilsForm.FirebirdQuery.First;
   while not FirebirdUtilsForm.FirebirdQuery.EOF do
   begin

ExecSQL is for statements that do not return a result set.
https://lazarus-ccr.sourceforge.io/docs/fcl/sqldb/tcustomsqlquery.execsql.html

Set Active to True to open the result set.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

Neville

  • New Member
  • *
  • Posts: 47
Re: SQL
« Reply #2 on: December 27, 2024, 08:22:58 pm »
Many thanks.  That works fine (of course).

 

TinyPortal © 2005-2018