Board index » delphi » simple query, big problem...

simple query, big problem...

with Delphi 4, Interbase 5.0, an error occurs when I try to execute this :

Query1.SQL.Text := 'insert into MYTABLE (MYFIELD) values ("xxx' : xxx")';
Query1.ExecSQL;

It seems that Delphi doesn't know what to do with both ' and : characters in
the same string...

Problem is I don't want to use Params property.

Thanks.

Christophe Cerbourg
deca...@wanadoo.fr

 

Re:simple query, big problem...


Quote
>Query1.SQL.Text := 'insert into MYTABLE (MYFIELD) values ("xxx' : xxx")';
>Query1.ExecSQL;

>It seems that Delphi doesn't know what to do with both ' and : characters in
>the same string...

>Problem is I don't want to use Params property.

>Thanks.

I noticed when I copied and pasted your code into Delphi you used double quotes
to do your values statement.  That is what is causing the problem.  Do this:

Query1.SQL.Text := 'insert into MYTABLE1 (MYFIELD) values (''xxx : xxx'')';

All the quotes are single quotes not double.  It should work.

********************************
Michael Glatz
glatzfa...@aol.com
mgl...@briefcase.com

Re:simple query, big problem...


1. set query.ParamCheck := false before modifying sql
2. for values use single, not double quotes
Query1.SQL.Text := 'insert into MYTABLE (MYFIELD) values (''xxx : xxx'')';
3. if your value contains quotes then double it.
Query1.SQL.Text := 'insert into MYTABLE (MYFIELD) values (''xxx'''' :
xxx'')';

--
-------------------------
Regards,
Robert

Remove leading aa when replying.
MailTo: aarobert.ce...@eunet.si

NO QUESTIONS VIA EMAIL. IF YOU WANT ADDITIONAL INFO, ASK HERE.

Quote
christophe cerbourg wrote in message <74336q$ke...@platane.wanadoo.fr>...
>with Delphi 4, Interbase 5.0, an error occurs when I try to execute this :

>Query1.SQL.Text := 'insert into MYTABLE (MYFIELD) values ("xxx' : xxx")';
>Query1.ExecSQL;

>It seems that Delphi doesn't know what to do with both ' and : characters
in
>the same string...

>Problem is I don't want to use Params property.

>Thanks.

>Christophe Cerbourg
>deca...@wanadoo.fr

Other Threads