Subject | Re: [IBO] IBOQuery and Refresh |
---|---|
Author | Helen Borrie |
Post date | 2007-09-12T08:18:53Z |
At 04:21 PM 12/09/2007, you wrote:
passed in the statement is a string. The first is a TIMESTAMP, the
second an INTEGER. So, before we go bananas with reproducible cases,
etc., I would like you to do a few simple reality checks on these parameters.
1. Put a monitor on your application and see what exact values are
being passed for each one, using your query as it stands. Delphi is
possibly trying to pass something weird in that timestamp parameter.
2. Change this parameter assignment:
IBOQuery1.ParamByName('DATUM').asDateTime := StrToDate('1.1.2007');
to (first test):
a) IBOQuery1.ParamByName('DATUM').asDateTime := StrToDate('1/1/2007');
Ideally, you should assign a TDateTime variable directly. There are
properties in date/time-aware Delphi controls to enable this. Unless
a lot of things are set up correctly in Delphi, trying to use
StrToDate can be almost relied on to cause problems with any date
formats other than the US mm/dd/yyyy (or m/d/yyyy in mixes of singles
and doubles). If you MUST use text strings that are non-US date
formats (as most of us do) then write a conversion function using
EncodeDate or EncodeDateTime.
b) (second test):
IBOQuery1.ParamByName('DATUM').AsRawString := '''1.1.2007''';
(Those are groups of 3 single quotes, no double quotes.) This should
pass your "Firebird-legal" date format as a date literal, i.e. a
string-like structure surrounded by single-quotes.
Helen
>Hi,This is not convincing, given that neither of the parameters being
>
>I have IBO 4.8.6. I have IBOQuery running the following query:
>
>select
>ID, ZKR, DATUM,
>(select NAZ from TAB2 where ID = TAB1.ID and TYP = :TYP) as NAZ
>from TAB1
>where DATUM = :DATUM
>
>This is the piece of code, that I use for opening the query:
>
>IBOQuery1.ParamByName('DATUM').asDateTime := StrToDate('1.1.2007');
>IBOQuery1.ParamByName('TYP').asInteger := 2;
>IBOQuery1.Open;
>
>When I call IBOQuery1.Refresh, I give the following error:
>
>ISC ERROR CODE:335544569
>
>ISC ERROR MESSAGE:
>Dynamic SQL Error
>SQL error code = -303
>conversion error from string "2"
>
>This error occurs only if there is OldParameterOrdering = 0 in
>firebird.conf. If there is OldParameterOrdering = 1, everything is OK.
>I have tried FB 1.5.4 and FB 2.0.1, with the same result.
passed in the statement is a string. The first is a TIMESTAMP, the
second an INTEGER. So, before we go bananas with reproducible cases,
etc., I would like you to do a few simple reality checks on these parameters.
1. Put a monitor on your application and see what exact values are
being passed for each one, using your query as it stands. Delphi is
possibly trying to pass something weird in that timestamp parameter.
2. Change this parameter assignment:
IBOQuery1.ParamByName('DATUM').asDateTime := StrToDate('1.1.2007');
to (first test):
a) IBOQuery1.ParamByName('DATUM').asDateTime := StrToDate('1/1/2007');
Ideally, you should assign a TDateTime variable directly. There are
properties in date/time-aware Delphi controls to enable this. Unless
a lot of things are set up correctly in Delphi, trying to use
StrToDate can be almost relied on to cause problems with any date
formats other than the US mm/dd/yyyy (or m/d/yyyy in mixes of singles
and doubles). If you MUST use text strings that are non-US date
formats (as most of us do) then write a conversion function using
EncodeDate or EncodeDateTime.
b) (second test):
IBOQuery1.ParamByName('DATUM').AsRawString := '''1.1.2007''';
(Those are groups of 3 single quotes, no double quotes.) This should
pass your "Firebird-legal" date format as a date literal, i.e. a
string-like structure surrounded by single-quotes.
Helen