1. problem with using variables in SQL statement
hi.. being relatively new to SQL (2 days :) I'm about to ask a
probably stupid question, but please bear with me...
I have an Access database, and have created a form with which you can
enter a search string and search the database. I'm doing this using a
normal form and post command, and grabbing the inputted form string,
which I assign to a varible... Everything works fine as long as I
include an entire word to search for... but when I use the LIKE
command, things don't go quite as I would expect.. (and not like the
books or reference materials tell me it should..)
example:
first I grab the string from the form....
searchterm=Request.Form("search")
then I insert it into a SQL statement:
Set RS = MyConn.Execute("SELECT word, definition FROM glossary where
word LIKE '"& searchterm &"' ;")
my problem is that this works exactly as if I had used the = operator
instead of LIKE, returning a match only if the exact word I enter is
in the table.
If I hardcode a search term string using LIKE, then it performs as
expected.. and returns any entry that resembles my search term, but
when I use a variable, it doesn't...
can someone Please tell me what I'm doing wrong?
thanks... -paul
2. Star vs snowflake schema
3. Newbie Q: Using variables in SQL
4. DTS - Connection Datasource prob.
5. using variable from SQL
6. Max Function in SQL Statement
7. using variables in sql
8. Paradox 4.0/Best PAL limitaion. Any work arounds?
9. Newbie Q: Using variables in SQL
10. Using variable in SQL statement
11. Selection using variables in SQL ?
12. Help! Using variables in SQL statement