Hi All,
I am trying to use a like clause to search for records from Access Db. How the query does not return any rows.
When I run the same exact query directly in access it works perfectly.
Code:
Dim selectSQL
getConnection() ' gets the connection
Set recordSet = Server.CreateObject("ADODB.Recordset")
selectSQL = "SELECT * FROM Members WHERE "
selectSql = selectSql & " Members.Userid LIKE '*sa*' "
/*
'selectSql = " select * from Members"
If I use this above statement , the query returns all the results.
*/
Response.Write(selectSql)
'Prints select * from Members where useriD like '*sa*'
' When run in access the query returns rows ,
' when I run it here, it does not return any thing.
' I have also tried, replacing single quotes with
' double without luck. select * from Members where useriD like "*sa*"
set recordSet = oConn.Execute(selectSql)
if (NOT recordSet.EOF) then
Response.Write("<br> Record Set is NOT EMPTY <br>")
else
Response.Write("<br> Record Set is EMPTY <br>")
end if
TIA,
Saurabh