Question

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!

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top