I have a project that I'm converting from Delphi XE to Delphi XE3, and am using your SDAC components.
One form has a TMSTable component with a field that is defined as TFloatField mapped to to SQL Server field of type Real. Everything worked fine in Delphi XE but now, when I open the TMSTable component it returns the following error:
Type mismatch for field 'HLSOFPerc', expecting: Float actual: Single.
If I open the .DFM file in text editor and change the type to TSingleField, then it works. How come this has changed? What is the quickest way to fix this problem, as my projects have many forms with TMSTable components and TMSQuery components that have TFloatFields that may be mapped to SQL Real type field.
Type mismatch for field 'xxxxxx', expecting: Float actual: Single.
Re: Type mismatch for field 'xxxxxx', expecting: Float actual: Single.
In the SDAC version 6.2.7 we added the new functionality - data type mapping, that allows mapping of server data types to IDE types. To fully support data mapping, we made several changes in field creation that also slightly increase performance. In SDAC 6.2.7 and higher, for the SQL Server type REAL the TSingleField field is created. To return the old behaviour, you should add the following mapping rule:After this, for the SQL Server type REAL the TFloatField field will be created. Please note that to use the msReal variable, you should add the MSDataTypeMap unit to the USES clause of your unit.
Code: Select all
MSConnection.DataTypeMap.AddDBTypeRule(msReal, ftFloat);
Re: Type mismatch for field 'xxxxxx', expecting: Float actual: Single.
Hi AndreZ,
Thank you for your prompt reply. Your solution worked fine.
Thank you.
Thank you for your prompt reply. Your solution worked fine.
Thank you.
Re: Type mismatch for field 'xxxxxx', expecting: Float actual: Single.
I am glad to help. Feel free to contact us if you have any further questions about SDAC.
Re: Type mismatch for field 'xxxxxx', expecting: Float actual: Single.
hi, can i somehow set it globally, for all TMSConnection instances? some nice commands i some unit interface section... please so that i do not have to subclass the TMSConnection class and replace everywhere...
Thanks, Ludek.
Thanks, Ludek.
Re: Type mismatch for field 'xxxxxx', expecting: Float actual: Single.
Unfortunately, there is no such functionality. you can create your TMSConnection-descendant and set required mapping rules in the constructor, and use descendants instead of the original TMSConnection in the project