[DUG] Still hassling with ADO filter.

Alan Rose Alan at seabed.co.nz
Thu May 25 15:50:10 NZST 2006


Just need to group differently
'(VIEWER = NULL AND UNITNO = 3) OR (VIEWER = NULL and UNITNO = 4)'

See clause d below from ADO Help


Filter is ADO-specific, not OLEDB provider specific. Here is what filter

should be (from ADO help): 

The criteria string is made up of clauses in the form 
FieldName-Operator-Value (for example, "LastName = 'Smith'"). You can
create 
compound clauses by concatenating individual clauses with AND (for
example, 
"LastName = 'Smith' AND FirstName = 'John'") or OR (for example,
"LastName = 
'Smith' OR LastName = 'Jones'"). Use the following guidelines for
criteria 
strings: 


  a.. FieldName must be a valid field name from the Recordset. If the
field 
name contains spaces, you must enclose the name in square brackets. 
  b.. Operator must be one of the following: <, >, <=, >=, <>, =, or
LIKE. 
  c.. Value is the value with which you will compare the field values
(for 
example, 'Smith', #8/24/95#, 12.345, or $50.00). Use single quotes with 
strings and pound signs (#) with dates. For numbers, you can use decimal

points, dollar signs, and scientific notation. If Operator is LIKE,
Value 
can use wildcards. Only the asterisk (*) and percent sign (%) wild cards
are 
allowed, and they must be the last character in the string. Value cannot
be 
null. 
    Note   To include single quotation marks (') in the filter Value,
use 
two single quotation marks to represent one. For example, to filter on 
O'Malley, the criteria string should be "col1 = 'O''Malley'". To include

single quotation marks at both the beginning and the end of the filter 
value, enclose the string with pound signs (#). For example, to filter
on 
'1', the criteria string should be "col1 = #'1'#". 
  d.. There is no precedence between AND and OR. Clauses can be grouped 
within parentheses. However, you cannot group clauses joined by an OR
and 
then join the group to another clause with an AND, like this: 
(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'e.. 
Instead, you would construct this filter as 
(LastName = 'Smith' AND FirstName = 'John') OR (LastName = 'Jones' AND 
FirstName = 'John')f.. In a LIKE clause, you can use a wildcard at the 
beginning and end of the pattern (for example, LastName Like '*mit*'),
or 
only at the end of the pattern (for example, LastName Like 'Smit*'). 

 

> -----Original Message-----
> From: delphi-bounces at ns3.123.co.nz 
> [mailto:delphi-bounces at ns3.123.co.nz] On Behalf Of Phil Scadden
> Sent: Thursday, 25 May 2006 3:25 p.m.
> To: delphi at ns3.123.co.nz
> Subject: [DUG] Still hassling with ADO filter.
> 
> okay, changed the filter.
> 
> '(VIEWER = NULL) AND (( UNITNO = 3 ) OR ( UNITNO = 4 ))'
> 
> This comes up with the same error (Argument incompatiblae, 
> out of range or in conflict).
> 
> However,
> '(VIEWER = NULL)'
> causes no problem,
> 
> (( UNITNO = 3 ) OR ( UNITNO = 4 ))
> causes no problem
> 
> Put the AND in there and no go.????!!!
> 
> ----------------------------------------------------------
> Phil Scadden, Institute of Geological and Nuclear Sciences
> 764 Cumberland St, Private Bag 1930, Dunedin, New Zealand Ph 
> +64 3 4799663, fax +64 3 477 5232
> 
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
> 



More information about the Delphi mailing list