|
-
Jan 14th, 2007, 08:31 AM
#1
Thread Starter
Junior Member
[RESOLVED] ADODC Recordset.Find - Single Character Wildcard
Sorry to be a bother again, but nowhere can I find
what the ADODC single-character wildcard is for the Find method.
Help says underscore (_) but it doesn't work for me.
e.g.:
Adodc1.Recordset.Find "Tag LIKE 'ab_d'"
*** Answer: ADODC doesn't support single character wildcards ***
Underscore works if it's run in an SQL statement:
e.g.
SQL="SELECT * FROM Table1 WHERE Title LIKE 'ab_d'"
Adodc1.RecordSource = SQL
Adodc1.Refresh
I could just use SQL, but I'm not sure what SQL statement
to use to do a Find within an existing record set. I can't use
a SELECT because the user may have changed a record that
would disappear with a new SELECT.
*** Answer: Unanswered ***
Also can't determine how to deal with finds where
the % and _ characters may be part of the search
pattern; e.g.: .Find "filename LIKE 'file_001.txt'" or
"Result LIKE '50%'". The backslash (\) Escape character
doesn't work as it does with MySQL.
*** Answer: Square brace literals - LIKE '50[%]' gets 50% and not 50lb ***
Last edited by jm1248; Jan 15th, 2007 at 08:23 AM.
Reason: Summarize
-
Jan 14th, 2007, 12:18 PM
#2
Re: ADODC Recordset.Find - Single Character Wildcard
The ADO Recordset Find and Filter methods do not support single character wildcards.
-
Jan 14th, 2007, 12:52 PM
#3
Thread Starter
Junior Member
Re: ADODC Recordset.Find - Single Character Wildcard
Thanks Bruce,
Did they used to? The VB6 ADO Help suggests it did.
Anyway, I'm going to use a programatic find instead.
Re the Escape question: Can you tell me what the ADO
expects in the SQL string to denote a literal character?
" .. can't determine how to deal with finds where
the % and _ characters may be part of the search
pattern; e.g.: .Find "filename LIKE 'file_001.txt'" or
"Result LIKE '50%'". The backslash (\) Escape character
doesn't work as it does with MySQL."
Thanks,
John
PS: Your Canucks really abused my Leafs last night!
-
Jan 14th, 2007, 05:06 PM
#4
Re: ADODC Recordset.Find - Single Character Wildcard
When using like you can specify valid characters for a position by placing them in square brackets (eg: [0123456789] to allow a number), so you should be able to simply place the character on its own inside square brackets. (From memory, I haven't checked!)
-
Jan 14th, 2007, 05:35 PM
#5
Thread Starter
Junior Member
Re: ADODC Recordset.Find - Single Character Wildcard
 Originally Posted by si_the_geek
When using like you can specify valid characters for a position by placing them in square brackets (eg: [0123456789] to allow a number), so you should be able to simply place the character on its own inside square brackets. (From memory, I haven't checked!)
So 50[%] should get 50% and not 50lb?
-
Jan 14th, 2007, 06:10 PM
#6
Re: ADODC Recordset.Find - Single Character Wildcard
Correct... but I'm not sure if it accepts wildcards in that manner, so it may not return 50%
-
Jan 15th, 2007, 02:48 AM
#7
Re: ADODC Recordset.Find - Single Character Wildcard
So 50[%] should get 50% and not 50lb?
No. Find and Filter only support "Starts With" and "Contains" wildcard searches. Ie 'A%' and/or '%A%'.
-
Jan 15th, 2007, 08:09 AM
#8
Thread Starter
Junior Member
Re: ADODC Recordset.Find - Single Character Wildcard
Thanks guys,
I'm using SQL statements for user searches with []'s to escape literals. Works fine.
I now only use ADODC.Find to reposition the recordset to its unique ID.
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
|