[V4MD] Escaping (allowing) single quote char

Irv Kalb Irv at furrypants.com
Mon Sep 22 12:12:05 CDT 2008


I'm trying to do a search in a table where the value of the field I'm 
trying to match has a single quote character in it.  I'm doing this 
in a routine and passing in a string to search for.  The entries in 
this field are often multiple words.  I've found that for multiple 
words, you need to surround the match word in single quotes.  The 
code is like this:

   cursor = poDB.SqlQuery("SELECT * FROM WordMapping WHERE WordFound = 
" & "'" & theWordIn & "'")

This works fine on multiple words (e.g, 'one two three').  But it 
fails if one of them as a single quote in it - the particular three 
word phrase it's getting caught on is:  'of humanity's past'.

   Error:462848

This seems perfectly reasonable as I'm using single quotes as the 
delimiter.  But how can I specify that I want to seach for a match 
where fields will have BOTH embedded spaces and one or more single 
quotes?

I see that there is a function called EscapeString, but I am unclear 
as to how I would use it in this case.

Thanks in advance,

Irv
-- 

Multimedia R Us


More information about the Valentina mailing list