Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread DBISAM VCL-STD - Error # 11949 SQL parsing error
Fri, Jun 20 2014 4:22 AMPermanent Link

Trond Lind Hansen

Using:

Delphi xe6 trial
DBisam Query on a form
DBISAM VCL-STD - Version 4.39 Build 1

Following statement works:

('select * from venner where id=1');

but this one not:

('select * from venner where navn ="Egil"');

giving me:

DBISAM Engine Error # 11949 SQL parsing error - Expected end
of statement but instead found navn in SELECT SQL statement at line 1,
column 34.


code:

Q1.Close;
 Q1.SQL.Clear;
 Q1.SQL.Add('select * from venner where where navn="Egil"');
 Q1.Open;

TLH
Fri, Jun 20 2014 5:56 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Trond

Q1.SQL.Add('select * from venner where where navn="Egil"');


There are two wheres.

Roy Lambert
Fri, Jun 20 2014 9:24 AMPermanent Link

Trond Lind Hansen

Roy Lambert wrote:

Trond

Q1.SQL.Add('select * from venner where where navn="Egil"');


There are two wheres.

Roy Lambert

Sorry....it should not be two "where"....but

Q1.SQL.Add('select * from venner where navn="Egil"');

Same error....

TLH
Fri, Jun 20 2014 10:21 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Trond


Its a long while since I used DBISAM but I think it should be single quotes round Egil not double quotes - taht's used for things like table names.

It could also be a non printing character that has somehow crept into the program code. Try typing the statement into DBSys and if runs there then it should work in your program.




Roy Lambert
Fri, Jun 20 2014 11:00 AMPermanent Link

Trond Lind Hansen

Roy

In DBSys it works ok when I use single quotes round Egil, but Delphi will not allow me to use single quotes round Egil...I have to use the single quotes for the whole statement...strange..
Fri, Jun 20 2014 11:12 AMPermanent Link

Trond Lind Hansen

Trond Lind Hansen wrote:

Roy

In DBSys it works ok when I use single quotes round Egil, but Delphi will not allow me to use single quotes round Egil...I have to use the single quotes for the whole statement...strange..

It works ok if I use single quotes round the whole statement like:

('select * from venner where RecordID = 1');
Fri, Jun 20 2014 11:34 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Trond


>In DBSys it works ok when I use single quotes round Egil, but Delphi will not allow me to use single quotes round Egil...I have to use the single quotes for the whole statement...strange..

Not really. Where you've gone wrong is misreading two single quotes for a double quote. What you can do is:

Q1.SQL.Add('select * from venner where navn = ' +QuotedStr('Egil'));

or

Q1.SQL.Add('select * from venner where where navn=''Egil''');

In Delphi when you want to include a quote character in a string in your code you have to use two single quotes so that Delphi can figure out what  is the start and end of the string and what is a character. The resulting string as part of the program in memory will only have one single quote make where you entered two.

Roy Lambert
Fri, Jun 20 2014 11:42 AMPermanent Link

Trond Lind Hansen

Hi Roy

Thanks a lot for your time. This one worked:

Q1.SQL.Add('select * from venner where navn = ' +QuotedStr('Egil'));

not this one:

Q1.SQL.Add('select * from venner where where navn=''Egil''');


Trond
Image