Partial keyword search using sql in ASP

Hello,

I have a problem with ASP and a MSACCESS database. I want to execute a query that selects all products that _begin_ with lets say 'COLA'.
Now when I execute that query under ACCESS with the following sql-statement

SELECT PRODUCTS.PRODUCTNAME
FROM PRODUCTS
WHERE (((PRODUCTS.PRODUCTNAME) Like 'COLA*'));

the output is

COLA-PEPSI
COLA-COKE

But when I try that with ASP the dataset is empty:

<%
If IsObject(Session("db/mymdb.mdb_conn")) Then
    Set conn = Session("db/mymdb.mdb_conn")
Else
    Set conn = Server.CreateObject("ADODB.Connection")
    curDir = Server.MapPath("db\mymdb.mdb")
    Conn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;password=xyz"
    Set Session("db/mymdb.mdb_conn") = conn
End If
%>
<%
    sql = "SELECT PRODUCTS.PRODUCTNAME  FROM PRODUCTS  WHERE (((PRODUCTS.PRODUCTNAME) Like 'COLA*'))   "
    If cstr(Param) <> "" And cstr(Data) <> "" Then
        sql = sql & " And [" & cstr(Param) & "] = " & cstr(Data)
    End If
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 3, 3
%>

Using the above rs is empty. What do I do wrong?
Can anybody help? Thanks!

Regards
Gero
l00ny_tn1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

clockwatcherCommented:
Try the '%' symbol:

 ([PRODUCTS].[PRODUCTNAME] Like 'COLA%')  
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
l00ny_tn1Author Commented:
Thanks!
Hm, interesting that the asterisk does not work...
MS says "The asterisk (*) character matches zero or more characters" ... but perhaps sql in ASP is ANSI-SQL and in ACCESS MS-SQL :)

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.