问题描述
Hi
我想从数据库获取数字,例如,如果数据库中的数字是44.7890000000,我想得到一个字符串44.789,相同的0.0010000000 - > 0.001,只需保留数字并修剪拖尾'0'。
我使用这个代码:
qrySth.Fields [i] .AsString - 它的工作,但我找到非常小的数字,如0.0000010000它变成1E-6。有没有办法禁用这个AsString方法的科学符号?
HiI 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?
谢谢!
推荐答案
作为替代设置字段的属性,您可以从 AsFloat
中读取,并直接将值传递给。它使用相同的格式模式。
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.
这篇关于如何在Delphi中禁用科学符号?AsString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!