Filter in a SQL
Posted: 02.03.2012, 11:40
Hi folks, spring is coming soon....problems too
Please look at the following code.
I get the error message at execution :
And I cannot work with the adding of filters in the SQL of CDS
What is my code miswriting ?
Thank you for any help
Please look at the following code.
ID_ENTETE id an Integer.for i := 1 to Length(Edit.Text) do begin
if Edit1.Text <> '' then
begin
xCode := RightStr(trim(Edit1.Text),5);
ClientDataSet2.Active := false;
ClientDataSet2.ParamByName('CodeArticle').AsString := xCode;
ClientDataSet2.Active := true;
ClientDataSet2.Refresh;
ch := CleEntete; // <--result of previous SQL ClientDataSet2
// looks like 1451,1568,1788,1888
// and may be more numbers
if ch = 'null' then
CDS.Filter := 'ID_ENTETE is null'
else
CDS.Filter := 'ID_ENTETE in (' + ch + ')' ;
CDS.Filtered := true;
CDS.Refresh;
end;
...... //<== rest of code
I get the error message at execution :
I tried to replace 'ID_ENTETE in (' + ch + ')' by 'ID_ENTETE is in (1245,1266,1278)' just to see. Same message.Syntax error near in
And I cannot work with the adding of filters in the SQL of CDS
What is my code miswriting ?
Thank you for any help