Page 1 of 1

SQL INSERT with double quote and colon: missing parameter value

Posted: Wed 27 Sep 2006 12:59
by Johannes Geyer
I try to execute the following SQL INSERT statement:
INSERT INTO FulltextEntry (FTContent, ID) VALUES ('ANNE":', 999)

I get the following error message (german):
EDatabaseError: Fehlender Wert für Parameter ', 999)

Is it a bug in dbExpress driver?
What can I do?

When executing the SQL statement in Query Analyzer, it works.
Using MS SQL Server 2000, Delphi 7, dbexpsda.dll 3.0.4

Posted: Wed 27 Sep 2006 14:47
by Antaeus
You should use parameters in this case. Try to change your code to something like this:

Code: Select all

  SQLQuery1.SQL.Text := 'INSERT INTO FulltextEntry (FTContent, ID) VALUES (:param, 999');
  SQLQuery1.ParamByName('param').AsString := 'ANNE":';

Posted: Thu 28 Sep 2006 05:42
by Johannes Geyer
Thank you. I will try it.

Will this issue be fixed in the future or is it not a bug?

I have 200+ SQL statements and it's a lot of work to change all of them just for a very rare case. Or do you know more cases that will not work?

Posted: Fri 29 Sep 2006 09:04
by Antaeus
This problem concerned some bugs of dbExpress. Setting CheckParams to False does not work in design time. Even if you set CheckParams to False SQLQuery tries to create params. Your query should work after performing following steps:
1) set CheckParams to False;
2) place space after colon in the string constant of the query;
3) remove parameters in parameters editor of SQLQuery.