Subject | Re: [firebird-support] Upgrade problem |
---|---|
Author | Martijn Tonies |
Post date | 2005-06-24T23:37:32Z |
Hello,
There are two ways to ignore those nasty quotes.
1) use the Delphi "QuotedString" function when concatenating a string
for SQL, eg:
Query.SQL.Add('select * from mytable where mysearch = ' +
QuotedString('VEHICULE DE L''AVANT BLIND'));
Which will double the single quote for you and surround it with quotes.
2) use parameters:
Query.SQL.Add('select * from mytable where mysearch = :myvalue');
Query.Prepare;
Query.ParamByName('myvalue').AsString := 'VEHICULE DE L''AVANT BLIND';
Query.Execute;
If there's somethign else you want, please explain it in more detail.
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
> Since I upgraded one of my databases to Firebird 1.5 dialect 3, a curiouscontains
> incident occurred. Whenever my Delphi programs search with sql that
> a ' as part of a string name, it ends the query. So, more than a year agoa
> user entered the nameShow us your code. It's not very good though ;-)
> VEHICULE DE L'AVANT BLIND
>
> In Firebird 1.2, he had no problem searching it. Now that I have upgraded,
> the system halts. I am not sure where to start. Help please.
There are two ways to ignore those nasty quotes.
1) use the Delphi "QuotedString" function when concatenating a string
for SQL, eg:
Query.SQL.Add('select * from mytable where mysearch = ' +
QuotedString('VEHICULE DE L''AVANT BLIND'));
Which will double the single quote for you and surround it with quotes.
2) use parameters:
Query.SQL.Add('select * from mytable where mysearch = :myvalue');
Query.Prepare;
Query.ParamByName('myvalue').AsString := 'VEHICULE DE L''AVANT BLIND';
Query.Execute;
If there's somethign else you want, please explain it in more detail.
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com