Subject Re: Antw: Re: [IBO] TIBOQuery ParamsByName SQL Error -804 data
Author Uwe Cramer
Hello, i find out that the problem is a float param instead of the date.
when i use query.params.parambyname and not query.parambyname
i got the error later when i set the parameter
query.params.parambyname('MyFloat').asFloat := MyFloatVar;

the first problem is that when i look in parm...text there is
"1,1" instead of "1.0" (comma instead of point)
in german the decimal separator is comma not point

so i try a simple integer value
query.params.parambyname('MyInt').asInteger := StrToInt(edit1.text);
and the statement
"select nr, nr * :MyInt as MultiNr from MyTable where nr = 2"
produced error -601 array/blob/data type no allowed in arithmetik

i don�t know how to go on.
regards uwe



>>> Uwe Cramer<uwe.cramer@...> 17.02.2002 11:48:36 >>>
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 "6.0.1.0" 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'
or
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;


regards,
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
www.ibobjects.com



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

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/







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

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/