englishman
asked on
apostrophe in asp search
When I use an apostrophe as part of a serch term - eg:
"men's thoughts"
I get a syntax error returned.
What is the workaround without replacing these in the database and then replacing them back in the search results?
Cheers
"men's thoughts"
I get a syntax error returned.
What is the workaround without replacing these in the database and then replacing them back in the search results?
Cheers
ASKER
I think I get what you mean but the database is not updated online; it is converted from some other format, then uploaded.
Could you provide more information then ?
cos a normal select wouldn't be doing difficult on it...
cos a normal select wouldn't be doing difficult on it...
ASKER
Just a normal select on a normal access table.
Keywords = Request.form("Keywords")
q = "SELECT * FROM dbase WHERE Keywords LIKE '%" & Keywords & "%"
(Actually a little more complex but essentially the same)
Keywords = Request.form("Keywords")
q = "SELECT * FROM dbase WHERE Keywords LIKE '%" & Keywords & "%"
(Actually a little more complex but essentially the same)
- or -
<%
MyString = replace(MyString, "'", "''")
%>
repace the single' with two ''. This will also work...
<%
MyString = replace(MyString, "'", "''")
%>
repace the single' with two ''. This will also work...
ASKER
Massey,
You're a star.
Nick
-grab points
You're a star.
Nick
-grab points
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<%MyString="men's thoughts"%>
and you insert it into the database, do it like this:
<%sql="insert into tablename (fieldname) values ('"&server.htmlencode(MySt
The function server.htmlencode handles the apostrophe, when you read it from the database you don't need to do anything
Hope it helps you