Query.Eof is always True, but there are certain entries in the SQL table for that period.And what are those certain dates?
when I replaced the SQL parameters to "2018-01-01" and "2018-03-01", I got the correct result.
Hi !
I have a problem with the following query: (the fileld date is type of date, Firebird 3.0.3 server dialect 3)
Query.Close;
Query.SQL.Clear;
Query.SQL.Add ('SELECT datum, some_fields FROM some_table WHERE datum BETWEEN :fromdate AND :todate ORDER BY datum');
Query.ParamByName('fromdate').AsDate := DateTimPicker_From.Date;
Query.ParamByName('todate').AsDate := DateTimPicker_To.Date;
Query.Open;
Query.Eof is always True, but there are certain entries in the SQL table for that period.
when I replaced the SQL parameters to "2018-01-01" and "2018-03-01", I got the correct result.
I would like to use the Parameterized Query as the date range varies, depending on how the user chooses.
Previously I used ZeosDBO, I have never had problems with the DateTime parameters. I'm doing something wrong or the ParamByName ('dat_param').AsDate (or AsDateTime) works differently ?
XUbuntu 17.10 i386, Lazarus 1.8.3 i386 gtk, Firebird 3.0.3, IBX 2.2 (applicatin also cross compiled to Win32)
As you can see ODD and DOD parameters is NULL, wherry strange ! The actual value should be '2010-01-01' ans '2017-12-22'.And you say these values were correct for "2018-01-01" and "2018-03-01" ?
ODD = 01-01-2018 18:02:08.147
DOD = 06-02-2018 18:02:11.666
Personally I think it is a bug in IBX. With simple queries everything is working as expected but with relatively complex queries is something went wrong ... this is just my opinion, maybe I'm wrong, needs more testing ...You could be right about IBX misinterpreting the parameters (or not finding them correctly).
Query.SQL.Add ('SELECT datum, some_fields FROM some_table WHERE datum BETWEEN :fromdate AND :todate ORDER BY datum');
Query.ParamByName('fromdate').AsDate := DateTimPicker_From.Date;
Query.ParamByName('todate').AsDate := DateTimPicker_To.Date;
Query.Open;
Query.Eof is always True, but there are certain entries in the SQL table for that period.
when I replaced the SQL parameters to "2018-01-01" and "2018-03-01", I got the correct result.
I would like to use the Parameterized Query as the date range varies, depending on how the user chooses.
SELECT datum, some_fields FROM some_table
WHERE datum BETWEEN DATE :fromdate AND DATE :todate ORDER BY datum
Yes I'm sure that interval is Ok, this Query is running in an old application with ZeosDBO with same parametrization without a problem ...
Personally I think it is a bug in IBX. With simple queries everything is working as expected but with relatively complex queries is something went wrong ... this is just my opinion, maybe I'm wrong, needs more testing ...
Hi Tony !I can see now where the problem lies. You are using a TIBDynamicGrid and that only works if the parameter values are set in the BeforeOpen event handler. Although that is how all the examples work, I would agree that this should be clearer in the documentation. The same constraint applies to the other IBX dynamic controls.
Here is a test program based on the Employee database, tested ...
At first it seems to have worked for me, but when I started it again, it did not work after the date change. The monitor tab can look at the execution SQL result ...