Recent

Author Topic: SQL  (Read 2528 times)

Neville

  • Jr. Member
  • **
  • Posts: 52
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: 1525
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.

Neville

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

 

TinyPortal © 2005-2018