 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Alan T Guest
|
Posted: Wed Apr 18, 2007 8:11 am Post subject: ADOQuery filter |
|
|
How do I make the filter something like 'LIKE' in SQL?
eg.
Name = 'John*'
so returns 'Johnny', 'Johnson', 'johnny', 'johnson' |
|
| Back to top |
|
 |
Paul Scott Guest
|
Posted: Wed Apr 18, 2007 5:08 pm Post subject: Re: ADOQuery filter |
|
|
On Wed, 18 Apr 2007 05:24:02 +0100, Alan T <alanpltseNOSPAM (AT) yahoo (DOT) com.au>
wrote:
| Quote: | How do I make the filter something like 'LIKE' in SQL?
eg.
Name = 'John*'
so returns 'Johnny', 'Johnson', 'johnny', 'johnson'
|
In SQL(server) (and Access-via-ADO) the wild card is a percent "%" not an
asterisk
name like 'John%'
--
Paul Scott
Information Management Systems
Macclesfield, UK. |
|
| Back to top |
|
 |
Alan T Guest
|
Posted: Thu Apr 19, 2007 5:15 am Post subject: Re: ADOQuery filter |
|
|
Thanks.
Can I make it case insensitive?
"Paul Scott" <paul.scott (AT) removethis_infmansys (DOT) com> wrote in message
news:op.tqzaojuldgyzbd@ims-w15.infmansys.net...
On Wed, 18 Apr 2007 05:24:02 +0100, Alan T <alanpltseNOSPAM (AT) yahoo (DOT) com.au>
wrote:
| Quote: | How do I make the filter something like 'LIKE' in SQL?
eg.
Name = 'John*'
so returns 'Johnny', 'Johnson', 'johnny', 'johnson'
|
In SQL(server) (and Access-via-ADO) the wild card is a percent "%" not an
asterisk
name like 'John%'
--
Paul Scott
Information Management Systems
Macclesfield, UK. |
|
| Back to top |
|
 |
Asim Guest
|
Posted: Thu Apr 19, 2007 8:11 am Post subject: Re: ADOQuery filter |
|
|
| Quote: |
Can I make it case insensitive?
|
Hi Alan,
It is case insensitive only by default, but in case you want it to be
case sensitive use COLLATE
Name COLLATE SQL_Latin1_General_CP1_CS_AS like 'John%'
with results like 'Johnny', 'Johnson'
excluding 'johnny', 'johnson'
Regards,
Asim Khan
--- posted by geoForum on http://delphi.newswhat.com |
|
| Back to top |
|
 |
Alan T Guest
|
Posted: Fri Apr 20, 2007 8:11 am Post subject: Re: ADOQuery filter |
|
|
Sorry, what I want to do is not using SQL but set the Filter property of the
ADOQuery component.
"Asim" <akasimkhan (AT) yahoo (DOT) com> wrote in message
news:4626daf5$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
Can I make it case insensitive?
Hi Alan,
It is case insensitive only by default, but in case you want it to be
case sensitive use COLLATE
Name COLLATE SQL_Latin1_General_CP1_CS_AS like 'John%'
with results like 'Johnny', 'Johnson'
excluding 'johnny', 'johnson'
Regards,
Asim Khan
--- posted by geoForum on http://delphi.newswhat.com |
|
|
| Back to top |
|
 |
Asim Guest
|
Posted: Fri Apr 20, 2007 8:11 am Post subject: Re: ADOQuery filter |
|
|
Hi Alan,
Set Filtered := True;
and EITHER implement the following method, something like
procedure TForm.ADOQueryFilterRecord(DataSet: TDataSet;
var Accept: Boolean);
begin
Accept:=(DataSet.FieldByName('State').Value='CA') or
(DataSet.FieldByName('State').Value=Null)
end;
OR
Filter := 'State = ' + QuotedStr('CA') + ' OR ' +
'State = NULL';
Regards,
Asim Khan
--- posted by geoForum on http://delphi.newswhat.com |
|
| Back to top |
|
 |
Steve Zimmelman Guest
|
Posted: Wed Apr 25, 2007 8:11 am Post subject: Re: ADOQuery filter |
|
|
This works with MS SQL Server and the SQLOLEDB provider.
AdoQuery1.Filter = 'Name like ''John%'' ';
AdoQuery1.Filtered := True ;
-Steve-
"Alan T" <alanpltseNOSPAM (AT) yahoo (DOT) com.au> wrote in message
news:46259d43$1 (AT) newsgroups (DOT) borland.com...
| Quote: | How do I make the filter something like 'LIKE' in SQL?
eg.
Name = 'John*'
so returns 'Johnny', 'Johnson', 'johnny', 'johnson'
|
|
|
| Back to top |
|
 |
Alan T Guest
|
Posted: Mon May 14, 2007 7:54 am Post subject: Re: ADOQuery filter |
|
|
Thanks.
It works.
"Steve Zimmelman" <skz (AT) charter (DOT) nospam.net> wrote in message
news:462ec2f4 (AT) newsgroups (DOT) borland.com...
| Quote: | This works with MS SQL Server and the SQLOLEDB provider.
AdoQuery1.Filter = 'Name like ''John%'' ';
AdoQuery1.Filtered := True ;
-Steve-
"Alan T" <alanpltseNOSPAM (AT) yahoo (DOT) com.au> wrote in message
news:46259d43$1 (AT) newsgroups (DOT) borland.com...
How do I make the filter something like 'LIKE' in SQL?
eg.
Name = 'John*'
so returns 'Johnny', 'Johnson', 'johnny', 'johnson'
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|