Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using LIKE and * in ADO command object 1

Status
Not open for further replies.

Durkin

Programmer
Joined
Nov 6, 2000
Messages
304
Location
GB
I seem to have a problem using LIKE and * in the where clause of an sql statement which I'm using as the commandtext of a command object. It's a statement that's built at runtime so I always use LIKE whether it has any wildcards or not. If the statement uses:
Code:
Status LIKE 'U'
then it works fine and I get back the expected records, however if I use:
Code:
Status LIKE 'U*'
then I am returned no records.
I am using an Access 2000 database so I went into the query builder and pasted in the sql with the * and it worked fine so it must have to do with the command object rather than Jet. I'm at a loss to explain this strange behaviour so any help would be much appreciated. Durkin
alandurkin@bigpond.com
 
Statements using the keyword 'LIKE' will use the wildcard of '%' in ADO
David Paulson


 
strsql = "status like '" & "*'"
 
Thanks David. :~/ Durkin
alandurkin@bigpond.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top