|
-
Sep 16th, 2005, 12:50 AM
#1
Thread Starter
Addicted Member
Why can't I use the "LIKE" query?
I am using a VB6 Enterprise Edition, and I am accesing an MS Access database using MS Jet 4.0...
How can I use the LIKE query? If I can't, how can I search a database for a substring instead of the whole data in the record?
-
Sep 16th, 2005, 01:06 AM
#2
Re: Why can't I use the "LIKE" query?
 Originally Posted by bulletrick
I am using a VB6 Enterprise Edition, and I am accesing an MS Access database using MS Jet 4.0...
How can I use the LIKE query? If I can't, how can I search a database for a substring instead of the whole data in the record?
LIKE is used instead of = in the WHERE clause and use it with wildcards. The most common wildcards are * and ?.
Examples:
Code:
select * from MyTable where MyColumn like 'bulletrick*'
This query returns all rows where MyColumn begins with bulletrick.
Code:
select * from MyTable where MyColumn like '*bulletrick'
This query returns all rows where MyColumn end with bulletrick.
Code:
select * from MyTable where MyColumn like '*bulletrick*'
This query returns all rows where MyColumn contains bulletrick somewhere in the string.
-
Sep 16th, 2005, 01:25 AM
#3
Thread Starter
Addicted Member
Re: Why can't I use the "LIKE" query?
 Originally Posted by kaffenils
LIKE is used instead of = in the WHERE clause and use it with wildcards. The most common wildcards are * and ?.
Examples:
Code:
select * from MyTable where MyColumn like 'bulletrick*'
This query returns all rows where MyColumn begins with bulletrick.
Code:
select * from MyTable where MyColumn like '*bulletrick'
This query returns all rows where MyColumn end with bulletrick.
Code:
select * from MyTable where MyColumn like '*bulletrick*'
This query returns all rows where MyColumn contains bulletrick somewhere in the string.
Yep, I am using those statements but my program still produces errors.
-
Sep 16th, 2005, 01:32 AM
#4
Re: Why can't I use the "LIKE" query?
Can you post the error message and query.
-
Sep 16th, 2005, 07:17 AM
#5
Hyperactive Member
Re: Why can't I use the "LIKE" query?
You are using single not double quotes are you (as in the examples given).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|