Solved

double quotes "

Posted on 2004-08-15
3
242 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:lewin85_sg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Expert Comment

by:j2nku
ID: 11803712
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.
0
 
LVL 7

Accepted Solution

by:
j2nku earned 500 total points
ID: 11803717
Maybe the best way would be

searchstr = searchfrm & " LIKE " & "'%" & searchval & "%'"
0
 
LVL 1

Author Comment

by:lewin85_sg
ID: 11803737
thank you^^ that worked
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide cell in a table 2 45
Display if field is NOT "" or NOT null 6 37
Converting Stored Procedure to SQL Statement 5 63
Adding Clickable Links to JQuery Data Items 24 58
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question