Assigning a Currency type to a Param.value of an IBCQuery when Option.AutoPrepare = true

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lam
Posts: 13
Joined: Wed 09 Mar 2016 15:42

Assigning a Currency type to a Param.value of an IBCQuery when Option.AutoPrepare = true

Post by lam » Wed 11 Jan 2017 17:43

I am assigning a Currency type variable to a Param.Value on an IBCQuery and it is passing a NULL value on Open (option AutoPrepare is true), it ignores the value I assigned. Here is an example of what I need to do:

Code: Select all

var CurrencyParam, CurrencyRes : Currency;
begin
  CurrencyParam := 4443.3232;
  with IBCQuery2 do
  begin
    Close;
    Options.AutoPrepare := true;
    SQL.Text := 'SELECT CURRENCY FROM CurrTest WHERE CURRENCY > :CURRENCY_MIN';
    ParamByName('CURRENCY_MIN').Value := CurrencyParam;
    Open;
    First;
    while not Eof do
    begin
      CurrencyRes := FieldByName('CURRENCY').AsCurrency;
      Memo1.Lines.Add('Result ' + floatToStr(CurrencyRes));
      Next;
    end; // while
  end;
If I do one of these things:
  • Use a variable of type Double or Extended.
  • Assign the value with the "AsCurrency" property instead of "Value".
  • Turn the Option.AutoPrepare off.
The value is passed CORRECTLY but in my situation I need to do it this way.

Thanks in advance.

ViktorV
Devart Team
Posts: 2161
Joined: Wed 30 Jul 2014 07:16

Re: Assigning a Currency type to a Param.value of an IBCQuery when Option.AutoPrepare = true

Post by ViktorV » Thu 12 Jan 2017 16:32

Thank you for the information. We have reproduced the issue and investigation is in progress. We will inform you when we have any results.

lam
Posts: 13
Joined: Wed 09 Mar 2016 15:42

Re: Assigning a Currency type to a Param.value of an IBCQuery when Option.AutoPrepare = true

Post by lam » Fri 13 Jan 2017 15:45

Thank you, please do.

ViktorV
Devart Team
Posts: 2161
Joined: Wed 30 Jul 2014 07:16

Re: Assigning a Currency type to a Param.value of an IBCQuery when Option.AutoPrepare = true

Post by ViktorV » Mon 16 Jan 2017 08:36

Also as a workaround you can set the DataType property to ftCurrency before assigning a value to the parameter. For example:

Code: Select all

 
  ParamByName('CURRENCY_MIN').DataType := ftCurrency;
  ParamByName('CURRENCY_MIN').Value := CurrencyParam;

Post Reply