Page 1 of 1

Params not working for SQL 2005 Compact

Posted: Thu 16 Aug 2007 06:08
by tanong1957
I'm using SDAC 4.10's TMSQuery
My code is like ->

CLOSE;
SQL.TEXT := 'SELECT * FROM CUSTOMERS'+
' WHERE ACCTNO=:ACCTNO';
PARAMS[0].VALUE := 'ABCD';
OPEN;

It only works on SQL 2005/SQL 2005 Express.
But not on SQL 2005 COMPACT. It shows error:
REQUESTED CONVERSION NOT SUPPORTED...

Please guide me how to correct it.

Problem Solved.

Posted: Thu 16 Aug 2007 11:47
by tanong1957
I finally found a way.
Just set the param's datatype as variant ->

SQL.TEXT := 'SELECT * FROM CUSTOMERS'+
' WHERE ACCTNO=?';
PARAMS[0].DATATYPE := ftVARIANT;

...

CLOSE;
PARAMS[0].VALUE := 'ABCD';
OPEN;

It works great on both SQL Server and SQL Server Compact.
My app is totally scalable now. :D

Posted: Mon 20 Aug 2007 13:08
by Antaeus
This is an acceptable solution, but we recommend using exact data types like ftInteger, ftString instead of ftVariant.