Subject | Re: [firebird-support] Re: [ib-support] to change the decimal separator |
---|---|
Author | Alexandre Benson Smith |
Post date | 2006-08-30T04:17:48Z |
Adam wrote:
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;
var
wDecimalSeparator:Char;
begin
wDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.'
try
Result := FloatToStr(D);
finally
DecimalSeparator := wDecimalSeparator;
end;
end;
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
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
> FloatToStr is a Delphi function not a Firebird function. If it doesn'tAdam,
> 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;
> qry.open;
>
> 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;
var
wDecimalSeparator:Char;
begin
wDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.'
try
Result := FloatToStr(D);
finally
DecimalSeparator := wDecimalSeparator;
end;
end;
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
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br