Subject Re: [firebird-support] Re: [ib-support] to change the decimal separator
Author Alexandre Benson Smith
Adam wrote:
> FloatToStr is a Delphi function not a Firebird function. If it doesn't
> work properly with Regional settings, check out the Delphi support forums.
> Why are you passing a fixed string SQL where a parameter should be used?
> In delphi, it is something like:
> qry.sql.text := 'Select ID from the EVENTS where VALUE < :somevalue';
> qry.parambyname('somevalue').Value := MyFloatVariable;
> Parameters mean that you are not worrying about formatting preferences
> when dealing with data.
> Adam


I think he is saying that the application when running on countries that
uses comma as a decimal separator (instead of point like in USA) the
numbers are formated with commas by the StrToFloat.

I face it every time :-)

I have a FloatToStrSQL function that lookslike this:

function FloatToStrSQL(D:Extended):String;


wDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.'
Result := FloatToStr(D);
DecimalSeparator := wDecimalSeparator;

this way I am always sure I will use a point as a Decimal Separator no
matter how the current locale are set.

see you !

Alexandre Benson Smith
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil