We just purchased SDAC and immediately got this message. This error does not get raised with ADO.
This was not a query but an update statement. What is the solution to fixing this problem? The field "ACTOR_MEMCISID" is a varchar(13).
ERROR MESSAGE :
An exception was raised on the server: Statement(s) could not be prepared.
Disallowed implicit conversion from data type sql_variant to data type varchar, table 'NUAVS.dbo.TBL_LDAP_CURRENT', column 'ACTOR_MEMCISID'. Use the CONVERT function to run this query.
Switching from ADO to SDAC, and getting sql_variant to varchar conversion error
You have to specify the parameters information before calling the TMemDataSet.Prepare method.
For example:
For example:
Code: Select all
MSQuery1.SQL.Text := 'update TestTable set c_varchar = :p1 where ID = :p2';
MSQuery1.ParamByName('p1').ParamType := ptInput;
MSQuery1.ParamByName('p1').DataType := ftString;
MSQuery1.ParamByName('p2').ParamType := ptInput;
MSQuery1.ParamByName('p2').DataType := ftInteger;
MSQuery1.Prepare;
MSQuery1.ParamByName('p1').Value := '123456789';
MSQuery1.ParamByName('p2').Value := 1;
MSQuery1.Execute;