Why am I getting an EVariantTypeCastError when I call Locate?

This line of code:

Q.Locate('HS_VID', VarArrayOf([hsVid]), []);

      

gives me this error:

Project Test.exe raised the EVariantTypeCasterror exception class with the message "Unable to convert variant type (OleStr)".

variables are declared like this:

var
  Q: TADOQuery;
  hsVid: string;

      

Q

indexed into the field HS_VID

. SQL for Q

:

Q.SQL.Add('SELECT * FROM HS_CONTSILO ORDER BY HS_VID');

      

Can anyone be wrong on this line?

+3


source to share





All Articles