Assigning a Currency type to a Param.value of an IBCQuery when Option.AutoPrepare = true
Posted: 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:
If I do one of these things:
Thanks in advance.
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;
- Use a variable of type Double or Extended.
- Assign the value with the "AsCurrency" property instead of "Value".
- Turn the Option.AutoPrepare off.
Thanks in advance.