Page 1 of 1

Quotes

Posted: Mon 07 May 2007 16:01
by Archer66
Hi,

Quotes can't be used in SQL, for example

SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1''

works but

SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1""

does not.

Using quotes is required when creating SQL in code.

qryX.SQL.Add('SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1"" ');

Using Turbo Delphi, IBDAC 2.0.0.6

Posted: Tue 08 May 2007 06:05
by Alex
This is not an IBDAC issue. InterBase interprets '' (two single quotes) as an empty value. When you use double quotes as quotation symbol, InterBase interprets it as an identifier name (e.g. table name, field name) in your case it tries to find an empty identifier.
As specified in Delphi/Pascal manual you should double single quotation symbol to include it in the string.
E.g.

Code: Select all

qryX.SQL.Add('SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1'''' ');  //<< four ' symbols

Posted: Tue 08 May 2007 06:31
by Archer66
Thanks for the info.

Guess BDE translates "" to '''' bc I have used "" several years without a problem in old projects.