Take the 2-minute tour ×

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...

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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 );
share|improve this answer
In recent Delphi versions, use the overloaded version of FormatFloat() that takes a TFormatSettings record as input. That way, you do not have to mess with the global variables. –  Remy Lebeau Jul 18 '12 at 23:19

how do you make string like that ? "insert into mst_value values (0,123, 0,234, 0,345) "

It is aking for SQL Injection, that wouldallow anyone to break into your program.

Use TQuery.Params instead, with strict datatype checking.

More reasoning on this in comments at http://issuetracker.delphi-jedi.org/view.php?id=5916

share|improve this answer

I am with Arioch on this. You should use a parameterized query instead. That will let the DB engine handle the formatting for you, eg:

value_a := 0,123; 
value_b := 0,234; 
value_c := 0,345; 

Query.SQL.Text := 'insert into mst_value values (:value_a, :value_b, :value_c)'; 
Query.ParamByName('value_a').AsFloat := value_a;
Query.ParamByName('value_a').AsFloat := value_b;
Query.ParamByName('value_a').AsFloat := value_c;
share|improve this answer

Your Answer


