Board index » delphi » SQL Contains not working correctly

SQL Contains not working correctly

I use ADO to access a MSAccess back end.  I can't seem to get the CONTAINS
SQL to work.  What is the syntax that will work since I see so many
different versions?  If contains ISN'T supported than what is the
alternative syntax for search a specific field for a string?

Thanks
Jim

 

Re:SQL Contains not working correctly


Instead of 'contains' use 'like' instead.  The * is a wildcard.
SELECT REQUEST.DESC
FROM REQUEST
WHERE REQUEST.DESC Like '*smart*';
Quote
RES17TRM wrote:
> I use ADO to access a MSAccess back end.  I can't seem to get the CONTAINS
> SQL to work.  What is the syntax that will work since I see so many
> different versions?  If contains ISN'T supported than what is the
> alternative syntax for search a specific field for a string?

> Thanks
> Jim

Re:SQL Contains not working correctly


With Delphi, use % at place of *

"Bruce Michener" <bmich...@boe.ca.gov> a crit dans le message de news:
3e84a22...@newsgroups.borland.com...

Quote
> Instead of 'contains' use 'like' instead.  The * is a wildcard.
> SELECT REQUEST.DESC
> FROM REQUEST
> WHERE REQUEST.DESC Like '*smart*';

> RES17TRM wrote:
> > I use ADO to access a MSAccess back end.  I can't seem to get the
CONTAINS
> > SQL to work.  What is the syntax that will work since I see so many
> > different versions?  If contains ISN'T supported than what is the
> > alternative syntax for search a specific field for a string?

> > Thanks
> > Jim

Re:SQL Contains not working correctly


Quote
"Alain962" <a...@leaweb.org> wrote in message

news:3e84b135@newsgroups.borland.com...

Quote
> "Bruce Michener" <bmich...@boe.ca.gov> a crit dans le message de news:
> 3e84a22...@newsgroups.borland.com...
> > Instead of 'contains' use 'like' instead.  The * is a wildcard.
> > SELECT REQUEST.DESC
> > FROM REQUEST
> > WHERE REQUEST.DESC Like '*smart*';
> With Delphi, use % at place of *

What do you mean 'with Delphi'?  '%' is the ADO wildcard character which
replaces the deprecated '*' used with ODBC.

--

 A: Top-posters.
 Q: What is the most annoying thing on Usenet?

Re:SQL Contains not working correctly


I mean WIth ADO in Delphi...
* is the wildcard chracter in Access....
Clear ?
"DRS" <d...@removethis.ihug.com.au> a crit dans le message de news:
3e84c...@newsgroups.borland.com...
Quote
> "Alain962" <a...@leaweb.org> wrote in message
> news:3e84b135@newsgroups.borland.com...
> > "Bruce Michener" <bmich...@boe.ca.gov> a crit dans le message de news:
> > 3e84a22...@newsgroups.borland.com...
> > > Instead of 'contains' use 'like' instead.  The * is a wildcard.
> > > SELECT REQUEST.DESC
> > > FROM REQUEST
> > > WHERE REQUEST.DESC Like '*smart*';

> > With Delphi, use % at place of *

> What do you mean 'with Delphi'?  '%' is the ADO wildcard character which
> replaces the deprecated '*' used with ODBC.

> --

>  A: Top-posters.
>  Q: What is the most annoying thing on Usenet?

Re:SQL Contains not working correctly


Quote
"Alain962" <a...@leaweb.org> wrote in message

news:3e84c355$1@newsgroups.borland.com...

Quote
> "DRS" <d...@removethis.ihug.com.au> a crit dans le message de news:
> 3e84c...@newsgroups.borland.com...
> > "Alain962" <a...@leaweb.org> wrote in message

[...]

Quote
> > > With Delphi, use % at place of *

> > What do you mean 'with Delphi'?  '%' is the ADO wildcard character which
> > replaces the deprecated '*' used with ODBC.
> I mean WIth ADO in Delphi...
> * is the wildcard chracter in Access....
> Clear ?

'*' is the wildcard when using Access itself because Access internally uses
DAO not ADO.  You still use '%' when querying an Access database via ADO,
with or without Delphi.

And please don't top-post.

--

 A: Top-posters.
 Q: What is the most annoying thing on Usenet?

Re:SQL Contains not working correctly


I KNOW

 * is the wildcard chracter in Access.... = NOT CLEAR THAT's IN ACCESS???

"DRS" <d...@removethis.ihug.com.au> a crit dans le message de news:
3e84c...@newsgroups.borland.com...

Quote
> "Alain962" <a...@leaweb.org> wrote in message
> news:3e84c355$1@newsgroups.borland.com...
> > "DRS" <d...@removethis.ihug.com.au> a crit dans le message de news:
> > 3e84c...@newsgroups.borland.com...
> > > "Alain962" <a...@leaweb.org> wrote in message

> [...]

> > > > With Delphi, use % at place of *

> > > What do you mean 'with Delphi'?  '%' is the ADO wildcard character
which
> > > replaces the deprecated '*' used with ODBC.

> > I mean WIth ADO in Delphi...
> > * is the wildcard chracter in Access....
> > Clear ?

> '*' is the wildcard when using Access itself because Access internally
uses
> DAO not ADO.  You still use '%' when querying an Access database via ADO,
> with or without Delphi.

> And please don't top-post.

> --

>  A: Top-posters.
>  Q: What is the most annoying thing on Usenet?

Re:SQL Contains not working correctly


Quote
"Alain962" <a...@leaweb.org> wrote in message

news:3e84d205@newsgroups.borland.com...

Please don't top-post.

--

 A: Top-posters.
 Q: What is the most annoying thing on Usenet?

Re:SQL Contains not working correctly


... ? ...
Quote
> Please don't top-post.

> --

>  A: Top-posters.
>  Q: What is the most annoying thing on Usenet?
>  NO... guys like you....

Other Threads