SQL query with like does not accept wild cards
Posted on 2001-07-27
I seem to be experiencing a strange problem. I am using ADODB to read an Access Database on an IIS server (actually I'm testing it with PWS). When I open a recordset with an sql query containing a 'where x like y' clause I am unable to use wild cards. If I use the * wild card then I get no records returned. A code segment is as below
whereClause = "WHERE Material Like '*Silk*'"
strSQL = "SELECT * FROM [Stock List] " & whereClause & " order by [Stock No];"
Response.Write "<BR>" & strSQL
objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly %>
If however I remove the wild card a get the expected results.
Anybody got any aideas as to what I am doing wrong?