SQL Compact and real-type fields

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 13
Joined: Thu 08 May 2014 15:49

SQL Compact and real-type fields

Post by yeohray2 » Wed 09 May 2018 16:14

Having problems with using real values in parameters, SDAC 8.0.5 on Delphi 7.

To reproduce the error, create this table in a SQL Server Compact database:

CREATE TABLE test (col1 nvarchar(128), col2 real)

Place this command in a TMSSQL component:

INSERT INTO test(col1, col2) VALUES (:col1, :col2)

At run time, call this:

dmlMain.Params[0].AsWideString := 'test';
dmlMain.Params[1].AsFloat := 1;

This fails with the following error:

'... EOLEDBError with message Requested conversion is not supported.'


Thanks in advance.

Devart Team
Posts: 84
Joined: Tue 03 Oct 2017 11:00

Re: SQL Compact and real-type fields

Post by Stellar » Thu 17 May 2018 14:27

Unfortunately, OLEDB Compact Edition does not support types conversion. You set the parameter to a float type value, which takes 8 bytes, but in the Database field it is of real type, which takes 4 bytes.
To solve the issue, you can set the parameter values as ftSingle, for example:
dmlMain.Params[1].AsSingle := 1;

Post Reply