Recent

Author Topic: [SOLVED] IBX uninitialised parameter.  (Read 995 times)

iru

  • Sr. Member
  • ****
  • Posts: 321
[SOLVED] IBX uninitialised parameter.
« on: September 24, 2019, 07:34:17 am »
Gentlefolk,

Environment: Linux Mint 19.2, Laz 2.02, IBX 2.3.2, Firebird 3.0.....

On the open of a IBX.IBDataSet with the SelectSQL property set to

'Select A.EVENTNUM, A.EVENTGENDER, A.EVENTTYPE, ......... From E VENTDATA A where A.EVENTCOMPETITION = :EVENTCOMPETITION and A.EVENTTYPE = :EVENTTYPE order....... ';

an exception occurs.

   SQL Param No. 1 (EVENTTYPE) is uninitialsed.

EVENTTYPE is varchar(3). All records in the table 'A' have EVENTTYPE with a non NUL value.

No parameters are set on the IBX.IBDataSet.

An open on IBX.IBDataSet with the SelectSQL property set to

'Select A.EVENTNUM, A.EVENTGENDER, A.EVENTTYPE,....... From EVENTDATA A where A.EVENTCOMPETITION = :EVENTCOMPETITION order.........';

works correctly with all records matching EVENTCOMPETITION displayed in a grid.

Any help/ideas/suggestions appreciated, Ian.

I reviewed the above and it prompted me to check some semi forgotten 'brilliant' code in the IBX.IBDataSetBeforeOpen routine.

Problem solved, Ian.

« Last Edit: September 24, 2019, 09:13:55 am by iru »

tonyw

  • Sr. Member
  • ****
  • Posts: 319
    • MWA Software
Re: [SOLVED] IBX uninitialised parameter.
« Reply #1 on: September 24, 2019, 10:56:35 am »
Have you given a value to the parameter ":EVENTTYPE"? The exception suggests not.

A common way to set the initial value is to do this in the dataset's "BeforeOpen" event hander. For example:

procedure TForm1.MyDataSetBeforeOpen(DataSet: TDataSet);
begin
  (Dataset as TIBDataSet).ParamByName('EVENTTYPE').AsString := ''xxx';
end;

When the select query is executed, it will then return all rows with column "EVENTTYPE" that have the value 'xxx'

Cityalex

  • Newbie
  • Posts: 2
Re: [SOLVED] IBX uninitialised parameter.
« Reply #2 on: October 11, 2019, 05:10:43 am »
It would be good if we could work together on issues related to good matters. Like this again in the future

 

TinyPortal © 2005-2018