problem executing select on more than one table in delphi and firebird

-1

select works in firebird, but the -104 error in delphi

IBQuery2.SQL.Add('select l.jb_cdempresa, l.jb_cdfilial, p.dtvencimento, l.jb_cdcontacredito, p.vlrpago,');
        IBQuery2.SQL.Add('l.jb_cdcontacredito, p.vlrpago, f.cnpj_cpf, f.insc_rg,l.cnpj, l.insc,');
        IBQuery2.SQL.Add('from ctaspagar p, lojas l, fornecedores f');
        IBQuery2.SQL.Add('where p.cdloja = l.cdloja');
        IBQuery2.SQL.Add('  and f.cdfornecedor = p.cdfornecedor');
        IBQuery2.SQL.Add('  and p.cdloja = '+(EdLoja.Text)+'');
        IBQuery2.SQL.Add('and p.dtlancamento between :Data_Inicial and :Data_Final');

    IBQuery2.ParamByName('Data_Inicial').Value:= strtoDate(EdDataIni.Text);
    IBQuery2.ParamByName('Data_Final').Value:= strtoDate(EdDataIni.Text);
    
asked by anonymous 14.12.2018 / 18:52

1 answer

0

The problem may be in the assignment of the date parameter. In Firebird the date pattern is mm/dd/yyyy then ...

IBQuery2.ParamByName('Data_Inicial').Value:= FormatDateTime('mm/dd/yyyy', strtoDate(EdDataIni.Text));
IBQuery2.ParamByName('Data_Final').Value:= FormatDateTime('mm/dd/yyyy', strtoDate(EdDataIni.Text));

Remember that this date must be enclosed in single quotation marks, so the parameter should receive:

QuotedStr(FormatDateTime(...
    
15.12.2018 / 16:14