how to use between in date data type

i have table firebird 2.5 like this:

id integer
name varchar(100)
birthdate Date

code this cannot load record, eventhough data exist in the table:
CustList := Manager.Find
.Where((
Linq.Sql<TDateTime, TDateTime>(
'({birthdate} BETWEEN ? AND ?)',
EncodeDateTime(1980, 1, 1, 00, 00, 00, 001),
EncodeDateTime(1980, 12, 31, 23, 59, 59, 999)))
.OrderBy('ID', False)
.List;
help me to fix this.

Use OnSqlExecuting event to inspect the generated SQL and parameter values Aurelius is using to have a better idea of what's going on.

thank you,
i can see wrong parameter value with OnSqlExecuting and fix with this code.

CustList := Manager.Find
.Where((
Linq.Sql<TDate, TDate>(
'({birthdate} BETWEEN ? AND ?)',
EncodeDate(1980, 1, 1),
EncodeDate(1980, 12, 31)))
.OrderBy('ID', False)
.List;

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.