Domanda

I'm migrating the version of my application from Delphi 2007 to Delphi XE4 and I'm having troubles with the TSingleField from TClientDataSet.

My application uses SQL to Load data into the TClientDataSet, and if I use

CAST(TABLE.FIELD AS FLOAT) AS FIELD

The field comes to ClientDataSet as TSingleField.

Is there a way to change this as the field comes to ClientDataSet as TFloatField like it comes in delphi 2007?

I'm using the Delphi XE4 driver to connect do the firebird.

Thanks!

--- EDIT ---

If there is no way to change, does anybody know how to create Aggregate Fields for the clientDataSet to calculate the TSingleFields? The problem is that i am not being abble to do that, and if I manually change the fieldtype from TSingleField to TFloatField the Aggregate works perfectly.

È stato utile?

Soluzione

I just ran into this problem myself while updating a Delphi 7 app to Delphi 10.1. One solution is to cast the FLOAT field as a DOUBLE PRECISION. That way the field type in the ClientDataSet's xml ends up as "r8" (TFloatField) rather than "r4" (TSingleField).

The other solution is to recreate the TFields (and/or TFieldsDefs) in the application so that the expected field type is TSingleField instead of TFloatField like before.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top