Why do I get "fb conversion error from string "0"" error when using a normal query?

814 Views Asked by At

I'm new to Delphi and Firebird. When I run the following query, I get an error:

fb conversion error from string "0"

RECEIPTDATE is a DATE column.

How should I change my query?

FDQueryDataBetween.SQL.Add('select * from RAPOR where RECEIPTDATE BETWEEN '+startDate+' AND '+stopDate+'');
1

There are 1 best solutions below

0
On

I solved the issue with using parameters.

FDQueryDataBetween.SQL.Add('select * from RAPOR where RECEIPTDATE BETWEEN :startDate AND :stopDate');
FDQueryDataBetween.ParamByName('startDate').AsDate:= DateTimePickerStart.Date;
FDQueryDataBetween.ParamByName('stopDate').AsDate:= DateTimePickerEnd.Date;