TIBCQuery: SQL syntax???

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mwk
Posts: 4
Joined: Sun 18 Apr 2010 20:00

TIBCQuery: SQL syntax???

Post by mwk » Sun 18 Apr 2010 20:15

Actually, I'm converting a BDE application to a program using firebird server. I have a table DBUSERS with two data fields: USERNO AND USERNAME, I use a TIBCQuery:

with IBCQuery1 do begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM dbusers WHERE username LIKE "A%"');
Open;
end;

The result is the following error:
Dynamic SQL Error
SQL error code; -206
Column unknown
A%
At line 1, column 38

What is the correct syntax for string operations???

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 19 Apr 2010 08:40

To solve the problem use single quotes instead of double, like this:

Code: Select all

SQL.Add('SELECT * FROM dbusers WHERE username LIKE ''A%'' '); 

mwk
Posts: 4
Joined: Sun 18 Apr 2010 20:00

Post by mwk » Tue 01 Jun 2010 23:15

Thank you!!! Now, it works fine...

Post Reply