Subject Re: Antw: Re: [IBO] TIBOQuery ParamsByName SQL Error -804 data type
Author Helen Borrie (TeamIBO)
At 02:56 PM 17-02-02 +0200, you wrote:
>IB Version is "" Dialect is "3"
>"MyDateVar" in Delphi is "tdate"
>"MyDateField" in IBtable is "Date"
>? "MySearchDate" ?
>? Parameter is only defined in the Statement ?

No, the parameter is checked by the database during Prepare and, if it is the wrong type, or (as in your case) an unknown type, you will get a database exception.

i.e. the database is receiving this statement:
select * from MyTable where MyDateField = 'some string'
select * from MyTable where MyDateField = <some date>

Neither is recognised by the database as DATE.

You can pass either a Date Literal in an SQL statement which you construct yourself (not recommended; and you can't use a parameter for this as it is not a string type) or you can pass a TDateTime. TDate is not the right format for converting to a Dialect 3 DATE type.

Change MyDateVar to a TDateTime and do

Query.ParamByName('MySearchDate').asDateTime := MyDateVar;

Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at