Subject Re: Antw: Re: [IBO] TIBOQuery ParamsByName SQL Error -804 data
Author Uwe Cramer
Hello Helen and thanks,
i try to change from "tdate" to"tdateTime" and "asDateTime" but
the error is the same. i also get the error if i use a "String" with
"asString"and i got the error in the line
Query.ParamByName('MySearchDate').asDateTime := MyDateVar;
not later in the line with "open"
can i set the param datatype before to avoid this errors?
regards Uwe

i got the error not after "open"

>>> Helen Borrie (TeamIBO<helebor@... ")"Newsgroups> 17.02.2002
11:31:35 >>>
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

IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________ - your IBO community resource for Tech Info
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to