[DUG] Single or Double quotes?
Allan, Samuel
S.A.Allan at massey.ac.nz
Tue Dec 13 09:54:20 NZDT 2005
I hate to state the obvious, but we have a function to set up our
strings for queries. It adds the single-quotes at beginning and end of
string and escapes apostrophes. So that you would create your sql like:
sql := 'field_name = ' + SQLString(someVariable);
That way we don't have to think about setting the string up right, but
also don't have to use parameters if you don't want to. It suits us, but
I don't know if it would suit you.
Samuel
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Phil Middlemiss
Sent: Tuesday, December 13 2005 9:29 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Single or Double quotes?
Sometimes I can use double quotes when adding a string to an SQL query
using Firebird with the Interbase Components. Other times I get an SQL
error and have to resort to using single quotes (which is a pain if the
string contains an apostrophe).
Can someone set me straight on the conditions under which single or
double quotes can be used in a query?
Cheers,
Phil.
More information about the Delphi
mailing list