Page 1 of 1

Query Vs UniQuery

Posted: Wed 23 Mar 2016 16:17
by surushm
Dears
I wrote a simple program with Tquery component (from builtin component on D7) conected to interbase database as below
SELECT CHD_CODE, CHD_NAME, CHD_FAMILY, CHD_STATUS, GRP_CODE
FROM CHILDS_T Childs_t
Where (1=1)
And (CHD_FAMILY Like "%'+Edit1.Text+'%")
And (CHD_STATUS=1)
Order by CHD_CODE
It works fine on IB database, But shows error on when I use Unidac TUniQueryat line
CHD_FAMILY Like "%'+Edit1.Text+'%"
what is my error?so what is your suggest?

Re: Query Vs UniQuery

Posted: Thu 24 Mar 2016 13:01
by ViktorV
To make your sample work correctly, you should replace the " character with '. For example:

Code: Select all

  UQuery.Sql.Text := 'SELECT CHD_CODE, CHD_NAME, CHD_FAMILY, CHD_STATUS, GRP_CODE '  +
                        'FROM CHILDS_T Childs_t ' +
                        'Where (1=1) ' +
                        'And (CHD_FAMILY Like ''%'+Edit1.Text+'%'') ' +
                        'And (CHD_STATUS=1) ' +
                        'Order by CHD_CODE';

Re: Query Vs UniQuery

Posted: Fri 25 Mar 2016 17:58
by surushm
Thanks
But I want to fill query.sql property at runtime.
Does your suggest will work in runtime?

Re: Query Vs UniQuery

Posted: Tue 29 Mar 2016 12:16
by ViktorV
Yes, our code will work in runtime.

Re: Query Vs UniQuery

Posted: Thu 31 Mar 2016 19:21
by surushm
thanks I will try so then inform you.

regards