August 21st, 2004, 03:38 PM
Kylix: Floats from MySQL end up truncated in app
I'm new to Delphi/Kylix, so perhaps there's someone to help me out with kind of a strange problem.
My application accesses a MySQL (3.23) server and tries to fetch some data from a table that includes a float column.
Whenever I do something like
I end up with an integer value (well, typed as float though).
There's nothing wrong with the query, this doesn't even work when I use a TDBGrid to display rows from that table. A manual query via telnet e.g. reveals:
mysql> select floatcol from sometable;
| floatcol |
| 83.7 |
| 83.2 |
| 84.1 |
| 82.8 |
| 83.5 |
| 83.3 |
| 84.4 |
| 83.5 |
8 rows in set (0.00 sec)
The DBGrid only shows these numbers as
and so on.
Any ideas what could be wrong here? I'm using Kylix 3.
August 21st, 2004, 08:26 PM
I would check the underlying TField value and see what the value of TField.Precision is set to.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
August 22nd, 2004, 03:13 AM
Thanks for the hint. Help however says, that the "Precision" property must be greater than 2 and that it is automatically set to 2 if someone/something tries to set it to a value less than 2.
Originally Posted by Scorpions4ever
In my case, the Precision is zero