SQL INSERT with double quote and colon: missing parameter value

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
Johannes Geyer
Posts: 6
Joined: Wed 27 Sep 2006 12:52

SQL INSERT with double quote and colon: missing parameter value

Post by Johannes Geyer » Wed 27 Sep 2006 12:59

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

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 27 Sep 2006 14:47

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":';

Johannes Geyer
Posts: 6
Joined: Wed 27 Sep 2006 12:52

Post by Johannes Geyer » Thu 28 Sep 2006 05:42

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?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 29 Sep 2006 09:04

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.

Post Reply