quote characters in queries
Posted: 01.03.2010, 14:58
Hi,
In my app I have found that if I have a TDBEdit, that is linked to a field in a mysql table (via a TZQuery, and TZconnection).
If I type a string with a single quote in it such as "test'test" the field is correctly posted to the database (and the quote is escaped on the way, checked with an ZSQLmonitor).
However if I try and build the query with code such as :
The quote is not escaped and ApplyUpdates flags an SQL error.
Is there any way round this ?
Cheers.
Phill.
In my app I have found that if I have a TDBEdit, that is linked to a field in a mysql table (via a TZQuery, and TZconnection).
If I type a string with a single quote in it such as "test'test" the field is correctly posted to the database (and the quote is escaped on the way, checked with an ZSQLmonitor).
However if I try and build the query with code such as :
Code: Select all
WITH ZEditQuery DO
BEGIN;
Append;
FieldByName(DBFChemCommonName).AsString:='test''test';
ApplyUpdates;
END;
Is there any way round this ?
Cheers.
Phill.