Query Help

06-20-2002, 12:30 AM
When ever I try to use a wild card in my search criterias I receive no returned records from a access database.

I am using the ADODB object in my asp code.

Here is my query:
1) "Select * From People Where People_Name = 'Johnny'"
I receive the record.

2) "Select * From People Where People_Name Like '*ohnn*'"
I receive no records.

If I run #2 query in the query window within the Access database I receive records.

Any Ideas?

06-20-2002, 12:52 AM
try this...

"Select * From People Where People_Name Like '%ohnn%'"

and in case you use a variable...

"Select * From People Where People_Name LIKE '%" & strKeyWord & "%'"

06-20-2002, 08:45 PM
It is amazing... In access you do not use % as a wild card. So I guess the ADODB object uses the % as a wild card.

Well it worked! Thanks

Derek Stone
06-20-2002, 09:43 PM
SQL uses % as a wildcard. It has nothing to do with ADO.

Good Luck

06-20-2002, 11:41 PM
That I do know but why does % work with a Access database?

With Access I have to use an * as the wildcard.

I figure the ADO object must be interpreting the query knowing the database type.

Derek Stone
06-21-2002, 10:46 AM
You need to use % with any SQL statement, including when you're using an Access database.

Good Luck

06-21-2002, 10:59 AM
If you open Access and build a query and use the % as a wild card the query will not work.

This is why I assumed to use the * as the wildcard for the web.

I thank you for suggesting the % - it does work in my web query.


06-21-2002, 01:18 PM
* is just for DAO, the native Access dataaccess object library. It is
just an MS thing. There are many other examples of standard
SQL syntax that don't work the same way in Access.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum