[Lazarus] TDataset result 1e2 instead of 100

Michael Van Canneyt michael at freepascal.org
Tue Apr 5 10:25:50 CEST 2016



On Tue, 5 Apr 2016, John Landmesser wrote:

> if i execute fo example a query with a oracle Database: 
>  
> Select 100 from dual;
>  
> Result will be 1e2 ( scientific notation )
>  
> as i learned from this:
>  
> https://sourceforge.net/p/zeoslib/tickets/22/
>  
> it's probably caused  by TDataset?
>  
> Is there any reason for the result > 99 displayed in scientific notation?
>  
> Ok, i can do a CAST(...) in my SQL-Code, but thats extra work for nothing!
>  
> Thanks for hints.

The person who answered the ticket is wrong.

TBufDataset is a TDataset descendent like any other, with no special
handling of float fields.

There are a bazillion ways to retrieve a field value; Without more detailed
knowledge of how the 1e2 was produced, it is impossible to help further:

Assuming it is a float field:
How a float field is formatted depends entirely on the format settings in
DefaultFormatSettings. If you are satisfied with the default settings, you
can use .AsString. If you are not, you must specify formatting yourself.

But another possibility is that it is retrieved as a currency field by the
DB layer etc.

In short: without more details, there is little we can say.

Michael.


More information about the Lazarus mailing list