Subject | Re: [IBO] Apostrphe within single quotes |
---|---|
Author | Helen Borrie |
Post date | 2004-11-13T04:08:17Z |
At 09:48 PM 12/11/2004 -0500, you wrote:
ParamByName('CharacterField').AsString :=
QuotedStr(ParamByName('CharacterField').AsString);
HB
>Suppose a user's input contains a search string like O'Rourke. The resultingEasy!! Let Delphi do the walking ---
>query would then contain the qualifier, ".where Last_Name containing (or =)
>'O'Rourke'. To avoid a SQL error, this needs to be changed to 'O''Rourke'.
>The obvious solution is simply to advise the user to add the second
>apostrophe manually. To try and avoid that, I have played with this a bit,
>but cannot find my way out of the semantic box created by the ambiguity
>between the apostrophe in the name and the ending single quote. Wondered if
>any of you know of a solution.
ParamByName('CharacterField').AsString :=
QuotedStr(ParamByName('CharacterField').AsString);
HB