Link to home
Start Free TrialLog in
Avatar of lewin85_sg
lewin85_sg

asked on

double quotes "

i've been getting a  Missing operand before '&' operator error.

my code needs to be  for example :
dv.RowFilter = "name LIKE '*david*'"

right now i'm trying to pass two variables i got from a form into that statement:

dim searchfrm = Request.Form("searchfrm")
dim searchval = Request.Form("searchval")

searchstr = """ + searchfrm + " " + "LIKE" + " " + "'*" + searchval + "*'" + """
dv.RowFilter = searchstr

However, this does not work.. I get the Missing operand before '&' operator error.
I tried Response.Write(searchstr), it displays the statement i want correctly but why wouldn't it work as a complete statement??

please help!! really urgent
Avatar of j2nku
j2nku
Flag of Estonia image

searchstr = """ + searchfrm + " " + "LIKE" + " " + "'*" + searchval + "*'" + """
dv.RowFilter = searchstr

Instead of " try chr(34)

Example:

searchstr = chr(34) & searchfrm & " LIKE " & "'*" & searchval & "*'" & chr(34)
dv.RowFilter = searchstr

And i'm not sure about the *

Better would be:

searchstr = chr(34) & searchfrm & " LIKE " & "'%" & searchval & "%'" & chr(34)
dv.RowFilter = searchstr

I've never seen this RowFilter function before, so this may not help.
ASKER CERTIFIED SOLUTION
Avatar of j2nku
j2nku
Flag of Estonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lewin85_sg
lewin85_sg

ASKER

thank you^^ that worked