🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #3692

Re: Does this code work on ADO?

#3692
From: Jurko
Date: Sun, 07 Jul 2002 11:29
41 lines
2441 bytes
> My record set object is dataset1. DB is MS-SQL server.
>
>     dataset1.Filter = "Age <= 18 AND (Age = NULL OR Age >= 30)" // First
Code
>
> This code doesn't work. But these codes work:
>
>     dataset1.Filter = "(Age = NULL OR Age >= 30)" // Second Code
>     dataset1.Filter = "Age <= 18 AND (Age = NULL AND Age >= 30)" // Third
Code
>
> Change is only OR on third code according to first code. I have changed OR
> to AND. (Condition is nonsensical, but that's not important) Second code
> works fine.
>
> What this does mean? Can not ADO analyze "(<Condition1> AND <Condition2>
> (<Condition3> OR <Condition4>)" style Filter?

Check the msdn for information on ADODB.Recordset Filter property.

As I recall it has some totaly strange restrictions on how the filter string
should
be formated... I didn't check it now but I think it was that it only allows
format
strings that look like this:

    ( A and B and C and ... ) or ( D and E and F and ... ) or ...

So it has to be groups of conditions separated by ORs and in each of those
groups
you can only have simple conditions (no ORs or ANDs) separated by ANDs...

My first guess would be that someone at MS didn't know how to make a simple
arithmetic expression parser at the time this code was written :-))) but
then again...
that's just way too unbelievable to be true... so my second guess would be
that
I'm overlooking something that's the real reason for this behavior... :-)

HTH,
    Jurko
Technical Details
Message-ID: <tl89ga.9hn.ln@news.ve-mil.hr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews!news.ve-mil.hr!not-for-mail
References: <3d278297_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,22e3398c1868196
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-07-08 00:39:52 PST
From: "Jurko" <Jurko@ve-mil.hr>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3d278297_2@dnews>
Subject: Re: Does this code work on ADO?
Date: Sun, 7 Jul 2002 13:29:33 +0200
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <tl89ga.9hn.ln@news.ve-mil.hr>
NNTP-Posting-Host: 195.29.221.130
X-Trace: dnews 1026113319 195.29.221.130 (8 Jul 2002 00:28:39 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews!news.ve-mil.hr!not-for-mail