1
votes

I am tryin to apply following filter on a AdoTable component but it shows error:

((details_id = 15) OR (details_id = 16) OR (details_id = 17)) AND(personel_id = 5)

the error is :

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

whats the wrong and how can I do this filter. I previously searched it on Delphi help but could not to solve it. Special Thanks in advance.

1
No its a sample code. I tried your comment but not solved the problem. - home rezaei
What makes you think the error has anything to do with OR and AND? - Olivier
I test the property with : (details_id = 15) OR (details_id = 16) OR (details_id = 17) and it was OK but when + 'AND' condition Not ok - home rezaei
Please show the source code where you assign this boolean expression. The problem seems not to be the expression but the way you use it: you assign it (or use it as argument) to something which do not accept a boolean. - fpiette
I have absolutely no idea if it's relevant, but you squeeze the "AND" and the "(" together, whereas for the "OR"s there's a space. Just a wild guess (don't think it's this, but it was all that sprang to mind when I saw it): Try ((details_id = 15) OR (details_id = 16) OR (details_id = 17)) AND (personel_id = 5) instead. - HeartWare

1 Answers

1
votes

If you are trying to make a filter on a table it is much more convenient to use TADOQuery and put:

TADOQuery.SQL.Text := 'SELECT * FROM TableName WHERE ((details_id = 15) OR (details_id = 16) OR (details_id = 17)) AND (personel_id = 5)'

where TableName is the name of your actual table. It is also much easier to manipulate with parameter values this way.

Even better you can write this:

TADOQuery.SQL.Text := 'SELECT * FROM TableName WHERE ((details_id IN (15, 16, 17)) AND (personel_id = 5)'