ADO, Access97 and LIKE 
Author Message
 ADO, Access97 and LIKE

Hi everyone,

I have the following problem concerning ADO, Access97 and the
LIKE-operator:

Set RS = DBConn.Execute("SELECT COUNT(*) AS Num FROM Addresses WHERE
FirstName = 'John';")

yields 123 for Num, BUT

Set RS = DBConn.Execute("SELECT COUNT(*) AS Num FROM Addresses WHERE
FirstName LIKE '*John*';")

yields 0 for Num.

I just can't figure out what's wrong here. Can somebody help me?

Thanks and regards   - Jan



Tue, 28 Oct 2003 01:33:14 GMT  
 ADO, Access97 and LIKE
ADO wants the ANSI_SQL wildcards of % and _  NOT JET's * and ?.  I'd lose
the trailing semicolon too, that an Access thing.

Set RS = DBConn.Execute("SELECT COUNT(*) AS Num FROM Addresses WHERE
FirstName LIKE '%John%'")

HTH
--
Patrick Logan, MCSD

Opinions expressed are my own and not necessarily those of my employer.


Quote:
> Hi everyone,

> I have the following problem concerning ADO, Access97 and the
> LIKE-operator:

> Set RS = DBConn.Execute("SELECT COUNT(*) AS Num FROM Addresses WHERE
> FirstName = 'John';")

> yields 123 for Num, BUT

> Set RS = DBConn.Execute("SELECT COUNT(*) AS Num FROM Addresses WHERE
> FirstName LIKE '*John*';")

> yields 0 for Num.

> I just can't figure out what's wrong here. Can somebody help me?

> Thanks and regards   - Jan



Tue, 28 Oct 2003 01:59:05 GMT  
 ADO, Access97 and LIKE
Hi Patrick,

Quote:

> ADO wants the ANSI_SQL wildcards of % and _  NOT JET's * and ?.  I'd lose
> the trailing semicolon too, that an Access thing.

> Set RS = DBConn.Execute("SELECT COUNT(*) AS Num FROM Addresses WHERE
> FirstName LIKE '%John%'")

Argh... Now it's working. Thanks a lot!

Greetings   - Jan



Tue, 28 Oct 2003 02:28:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Copy read-only liked tables

2. Access97 + ADO

3. Visual Liking in .Net using TREE VIEW control

4. DDE and the likes

5. ADO VB6 Access97 Unable to run Access Query -2147217900

6. VB6,Access97,ADO - Update query doesn't update all records

7. VB6/ADO/Access97 Security

8. Access97 and ADO

9. ADO and Access97

10. Likes CAT and Sport Query

11. ado access97

12. ADO VB6 Access97 Unable to run Access Query -2147217900

 

 
Powered by phpBB® Forum Software