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;
dmlMain.Execute;
This fails with the following error:
'... EOLEDBError with message Requested conversion is not supported.'
Help?
Thanks in advance.
SQL Compact and real-type fields
Re: SQL Compact and real-type fields
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;
To solve the issue, you can set the parameter values as ftSingle, for example:
dmlMain.Params[1].AsSingle := 1;
Re: SQL Compact and real-type fields
I'm using Delphi 7, and there isn't a AsSingle property for parameters, only AsFloat. Is there a workaround for this?
Thanks in advance.
Thanks in advance.
Re: SQL Compact and real-type fields
Unfortunately, in Delphi 7 there is no real type for the DataSet field occupying 4 bytes, correspondingly there is no type that can be used without conversion of real type in the database.
The only possibility is to use float instead of real in the database, then the data types will match.
The only possibility is to use float instead of real in the database, then the data types will match.