Page 1 of 1

sql server ce error "Requested conversion is not supported"

Posted: Sat 29 Jan 2011 09:54
by bugmenot1
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?

Posted: Mon 31 Jan 2011 16:42
by AndreyZ
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;