NOT modifier, does it exist?

Apr 17, 2012 at 6:30 PM

I can't seem to find a way to introduce the NOT operator into my WHERE clause.  For example:

SELECT * FROM Customers Cust

WHERE(  NOT (Cust.[CompanyName] LIKE 'ff%') )

 

That stub is what I'm going for.  Is there a way to invert your operators?  In the above cause it would be a "does not start with."

 

Thanks!

Apr 18, 2012 at 8:20 AM

Hey Ken

The DBComparison class has a number of static methods for constructing the filter clauses.

Try...

DBQuery sel = DBQuery.SelectAll()

                                 .From("Customers")

                                 .Where(

                                        DBComparison.Not(

                                            DBComparison.Compare(DBField.Field("CompanyName"), Compare.Like, DBConst.String("ff%"))));

It's not the prettiest, but it should do the job.