Subject Problem com IBOQuery.Parambyname
Author dallagnelo
I am migrando of BDE for IBO. very I am worried, therefore it has
places that the systems are being slower of the one than was. I
modified the component query for IBOQuery. When trying to pass
parameter occurs the error of DYNAMIC SQL ERROR SQL ERROR CODE = -
104, SQL was vĂ¡lidado in ibexpert and is correct. It follows
below
the code source:

IBOQUERY.CLOSE;
IBOQUERY.SQL.CLEAR;
IBOQUERY.SQL.ADD('SELECT');
IBOQUERY.SQL.ADD('1');
IBOQUERY.SQL.ADD('2');
IBOQUERY.SQL.ADD('3');
IBOQUERY.SQL.ADD('4');
IBOQUERY.SQL.ADD('WHERE');

IBOQUERY.SQL.ADD('A.DT_RECL between :DT_RECL1 and :DT_RECL2 ');
IBOQUERY.SQL.ADD('AND');
IBOQUERY.ParamByname('DT_RECL1').AsDateTime := eddata1.date;
IBOQUERY.ParamByname('DT_RECL2').AsDateTime := eddata2.date;

IBOQUERY.SQL.ADD('((A.Nr_OS = :NR_OS) OR (A.NR_LGI = :NR_OS)) ');
IBOQUERY.SQL.ADD('AND');
IBOQUERY.ParamByname('NR_OS').Text := edNR_OS.text;

IBOQUERY.Close;
IBOQUERY.SQL.Strings[0] := 'SELECT A.NR_OS, A.CD_CONMUL, ';
IBOQUERY.SQL.Strings[1] := 'FROM TAB_OS A ';
IBOQUERY.SQL.Strings[2] := '';
IBOQUERY.SQL.Strings[3] := '';
IBOQUERY.SQL.Strings[4] := '';
IBOQUERY.SQL.Strings[5] := 'WHERE';
IBOQUERY.SQL.ADD('ORDER BY A.DT_RECL');
IBOQUERY.open;