Subject | RE: using a parameter containing a single quote |
---|---|
Author | |
Post date | 2013-10-16T10:00:11Z |
Sorry, I had tried responding by email, but that was bounced. I recompiled this morning and now it works. No changes to the code at all. Don't you just love computers?
Many thanks for all you ideas and the quick response.
Anyway, for completeness here is the spec of components etc
Delphi XE2, FireDAC TADQuery, Firebird 2.5.2 with fbClient.dll - all fully updated
to remove any variability with passing the variable to routine, the email address has been hard coded. So code is:
Database
record 1 : email = pam.o'neill@...
record 2 : email = pam.oneill@...
Code
resourcestring
sql = 'SELECT * FROM PERSON WHERE EMAIL = :EMAIL';
sql1 = 'SELECT * FROM PERSON WHERE EMAIL = ''%s''';
...
begin
emailvar := 'pam.o''neill@...';
emailvar1 := 'pam.oneill@...';
AQuery := TADQuery.Create(nil);
try
AQuery.SQL.Text := sql;
AQuery.ParamByName('EMAIL').AsString := emailvar;
AQuery.Open;
result := not AQuery.IsEmpty;
AQuery.Close;
finally
AQuery.Free;
end;
end;
---In firebird-support@yahoogroups.com, <reinierolislagers@...> wrote:On 16/10/2013 00:48, russell@... wrote:
> Yes caught me out to, a single quote is allowed in email addresses toAFAIU, you still haven't indicated what data access components you use
> the left of the @ apparently.
with Delphi. As I think Mark said, the db access component should deal
with the quoting of the parameter for you.