Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different Regional Setting Different Format Float in Delphi

I want to make Insert SQL Statement in Delphi using BDE Paradox which is

value_a := 0,123;
value_b := 0,234;
value_c := 0,345;
insert into mst_value values (value_a, value_b, value_c);

it shows the error like 'invalid SQL parameter' after debugging, it shows that the sql complete syntax like

insert into mst_value values (0,123, 0,234, 0,345) 

which is supposed to be dot but comma in the decimal, so I format it using formatfloat('#.###, value_a), ...` it still using comma, after change the regional setting on Control Panel to English, the SQL parameter is correct, this is because the currency or number format there is just like 123,123,123.00, so, how can I format the decimal number but from another country e.g Indonesia with the format like 123,123,123,123.00 not 123.123.123,00. thanks before...

like image 584
user1210396 Avatar asked Oct 29 '25 09:10

user1210396


1 Answers

Try in this way, before calling the formatFloat function, you can set appropriate value for Delphi's variable ThousandsSeparator and DecimalSeparator :

FormatFloat( "$##.000", value_a );
like image 126
aleroot Avatar answered Oct 31 '25 02:10

aleroot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!