ADO Components and Delphi 7

ADO Components and Delphi 7

Post by Marti » Sat, 08 Jan 2005 07:44:01

I have just started using the ADO components that come with Delphi 7 and I
am having problems with queries against a microsoft access database.

I am using TADOConnection components with TADODataSet. The latter is linked
to a TDataSource component and then onto a DBGrid. The Connection is
specified as using Microsoft Jet OLEDB.4.0 and I use the CommandText
property of the TADODataSet to get the data. This all works fine except that
wildcards are not being processed correctly or not at all.

I have tested all the queries out in the microsoft access database and
queries such as
Where name like "B?ll", Where name like "B[ioa]ll", where name like "B*" all
give the proper results with * replacing everything, ? replacing a character
and [ioa] matching with Bill, Bob, Ball etc just as they should.

When I send these through the ADO components the queries do not work. To be
specific the ? and * do not work at all and the [aio] does work. I am
changing the CommandText and requerying the data every time I change the
where clause.
I did use the * command as a filter property of the TADODataSet component
instead of as part of the where clause and this did work but the ? and [aio]
will not work as part of a filter.

Does anyone know what I am doing wrong or whether there are some problems
with characters being used as control characters.

Any help would be most appreciated.

Thanks Martin.

ADO Components and Delphi 7

Post by Oscar Sant » Sun, 09 Jan 2005 13:45:40

Have you tried the standard T-SQL syntax of where name like 'B%'?
Just wondering if this would work.




ADO Components and Delphi 7

Post by Marti » Wed, 12 Jan 2005 05:50:53

Thanks Oscar,

That seems to do the trick the % works within and on the end of the queries
and it works with [aio] as well - so I guess together these do all I want
them to...