sql server ce error "Requested conversion is not supported"

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
bugmenot1
Posts: 6
Joined: Wed 04 Nov 2009 03:23

sql server ce error "Requested conversion is not supported"

Post by bugmenot1 » Sat 29 Jan 2011 09:54

I connected the sql server ce 3.5,and run the code

Code: Select all

str:='insert into test(aa)';
str:=str+' values(:aa)';
UniQuery1.Close;
UniQuery1.SQL.Clear;
UniQuery1.SQL.Add(str);
UniQuery1.ParamByName('aa').AsFloat:=12.3;
UniQuery1.Execute;
then show the error"Requested conversion is not supported".

why? and how to fix it?

AndreyZ

Post by AndreyZ » Mon 31 Jan 2011 16:42

Hello,

MS SQL Server CE does not support conversion of field types and values. To solve the problem you should use the following code:

Code: Select all

UniQuery1.SQL.Text := 'insert into test(aa) values(:aa)';
UniQuery1.ParamByName('aa').DataType := ftVariant;
UniQuery1.ParamByName('aa').Value := 12.3;
UniQuery1.Execute;

Post Reply