Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE SQL Statements???

Status
Not open for further replies.

pilg

Programmer
Feb 16, 2001
82
GB
Hi,

I'm new to this ASP stuff and I'm having trouble getting the like ststement to work for me with wildcards.

I have a page where a user enters a word or part of one to search for, I then pick this up and insert into a LIKE statement, which looks like this:

SQLString = "select * from externalpersonal where name Like = '" & name & "%'"

where name is the variable. Have I got the % in the right place, is this the right symbol, im using an access database.
I get the following error when run:

Syntax error (missing operator) in query expression 'name Like = 'ven%".

I suspect its something simple I'm missing, please help I need this done before I leave for XMAS.

Thanks in advance,

Pilg.


 
in access you need "*"

SQLString = "select * from externalpersonal where name Like = '" & name & "*'"
-----------------------------------------------------------------
"The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'."
- unknown

mikewolf@tst-us.com
 
Could it be removing the equal sign helps?

Like '" & name & "%'"


HTH
 
doh! didn't even see that falcon..... -----------------------------------------------------------------
"The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'."
- unknown

mikewolf@tst-us.com
 
Both corrections above are correct, you may also run into a problem with the fieldname "name" if it still doesn't work after the above two corrections than either place brackets around the fieldname or change it. I can't reemmber if name is a reserved word or not, but it sounds like one.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
No more vacation for me :(

FAQ FAQ20-2863
= new Forums.Posting.General.GettingAnswers()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top