Hello friends,

I am trying to make a simple search box in ASP.

I am using a text box, where the user enters his query. And besides it, I am using drop down menu (<select>.. <option>.. </select>) in which the user selects what he want to search (Song name, Artist, Album name, etc).

I am using the following code.

<%
Var = request.Form("sel")
Query = request.Form("query")
sql="Select Title, Artist, Link from Songs where " & Var &" = '" & Query & "'"
response.write(sql)
rs.Open sql, conn
%>

I am getting the following error:

Syntax error (missing operator) in query expression '= '''.

Can any one help me remove it?

Thanks! :)

i dont see anything wrong :(
can u post html as well

@ chsab420

Hello...

Thanks a lot for your reply..

I debugged it by using "If condition"

So if variable is blank....... the sql query is not executed.. !! :)

Have a good day. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.