SQL Query help w/ special characters
If I am trying to pass an & into a sql query, but I can't seem to get it to work.
For example, if I have a school name like "Texas A&M", how do you get it to recoginize the ampersand as part of the string?
Put the string in single quotes:
selection = "Texas A&M"
sql = "Select * from myTable Where selection = '" & selection & "';"
Thats what I tried initially, but that doesn't help.
See what I'm trying to do is, excute a search query based off of a passed parameter from a drop down menu.
Let me provide my code, as maybe it will make more sense what exactly is happening. I think the issue is not with the search query, but the passed value is not right. Let me explain.
This is the code from the dynamic dropdown...it passes if this is a search and the exact word to search for. However, I noticed in my browser bar, when I select for example Texas A&M, in the bar it puts this:
<OPTION style="width: 100px;" VALUE="shopsearch.asp?search=yes&Exact=<%=rs("pother1")%>"><%= rs("pother1") %></option>
The &M after Texas A&M is not parsed. I forget, but isn't there a way to wrap this, URLEncode or something like that?
Users Browsing this Thread
There are currently 1 users browsing this thread.
(0 members and 1 guests)