[SOLVED] sqlite3: Handling localization issues like numbers and decimal points lazarus / 16-Databases ---------------------------------------------------------------------- markusd112 · 2015-12-28 06:24 Hi, is there any best practice how to handle localization and number formatting issues when coding a database application with lazarus? For example I want to display some money amounts in a TDBgrid out of an sqlite3 database file. When I compile and run it under OS X, the values are displayed like "0.1", "1.52" and so on. Under Windows it displayed as "0,1", "1,52" and so on, so under windows it seems that the localization options are working (I am in germany, where you use a comma as decimal point. How should I handle this? Another issue is how to format money values: normally you want to display it with exactly two digits behind the decimal point (e.g. "0,10" and not "0,1" or "2,00" and not "2". In sqlite it seems that you have to solve this with a printf statement , e.g.: Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT printf("%.2f €", price) AS "Price"; When you do this, it will no longer display a comma as decimal point under windows: 0.10 € How these issues are normally solved by you? Is there any wiki/help article that covers such problems? Is it solved better in other DBMS like MySQL or Firebird? Thanks, Markus ---------------------------------------------------------------------- LacaK · 2015-12-28 07:45 One thing is displaying and another accessing field values (for example for computing) In case of displaying you can simply leave it as is, so local settings will take effect automatically. In case of accessing field values, simply use method AsFloat of TField class (TDataSet.Fields[n] or TDataSet.FieldByName methods returns TField object) ---------------------------------------------------------------------- markusd112 · 2015-12-28 08:10 Yes, I did the wrong attempt. I have now left the SQL statement without any manipulation (select price from tab_articles;) and set the DisplayFormat setting of the column in the TDBGrid to display it e.g. as an price amount with two digits and so on. Additionally I have found this topic regarding the same issue: http://forum.lazarus.freepascal.org/index.php?topic=2081.0 Now it works, thanks for your help! Best regards, Markus