问题
Hi I want to get numbers from database, for example, if the number in database is 44.7890000000, I would like to get a string 44.789, the same 0.0010000000 -> 0.001, just keep the numbers and trim the tailing '0'. I use this code: qrySth.Fields[i].AsString - it does its job but I find for very small numbers like 0.0000010000 it becomes 1E-6. Is there a way I could disable the scientific notation for this AsString method?
Thanks!
回答1:
As an alternative to setting the field's DisplayFormat property, you can read from AsFloat
and pass the value directly to FormatFloat. It uses the same format pattern.
来源:https://stackoverflow.com/questions/6077153/how-to-disable-scientific-notation-in-asstring-in-delphi