Subject Re: [firebird-support] locate O'Connor
Author Sam Hunt
Paul Vinkenoog wrote:

> Hi Sam,
>
> > sql.strings[2]:='where
> > upper(Last_Name)='+#39+uppercase(dbeditLastName.Text)+#39+' ';
> >
> > errors when dbeditLastName.Text contains an apostrophe (single
> > quote) in the name, as in O'Connor. The query reports that "Connor"
> > is an unknown token.
>
> Apostrophes have to be escaped with another apostrophe. In Delphi, do
> this:
>
> sql.strings[2] := 'where upper(Last_Name)='
> + AnsiQuotedStr( uppercase(dbeditLastName.Text), '''' );
>
> AnsiQuotedStr puts quote characters (specified in second arg) around
> the string given in the first arg, and doubles any quote chars that
> are in the string.
>
> With single-byte character sets, you can also use
>
> QuotedStr( s )
>
> which is equivalent to
>
> AnsiQuotedStr( s, '''' )
>
> (Please note that '''' passes just *one* single-quote character to
> the function.)
>
>
> Greetings,
> Paul Vinkenoog

Worked!
Thx so much.
Sam