Board index » delphi » "Some text //: more text and another "

"Some text //: more text and another "

I have a problem when updating records in Oracle.
I build a sql-statement:

    close;
    Sql.Clear;
    Sql.add('insert into TSTTXT(TEXT) Values(' + F + Edit1.Text + F + ')');
    ExecSql;

This of course works well, ALMOST always. I have found that the subject
content in edit1.text does not work. The combination of /: included between
a pair of " " causes the statement to fail. Outside the double quote, it
works fine.

Any suggestions?

I'm lost here.

Magnus

 

Re:"Some text //: more text and another "


Quote
>     close;
>     Sql.Clear;
>     Sql.add('insert into TSTTXT(TEXT) Values(' + F + Edit1.Text + F +
')');
>     ExecSql;

What is F ? A quote?
See QuotedStr function . It may help you.

--
Frederic Gelinas
Programmeur-Analyste
Si Informatique

Re:"Some text //: more text and another "


Text inside double quote is treated like that outside of it - like
identifiers, so parser assumes that parameter name follows colon. If you
want to quote a string literal, embed it into single quotes.
F := ''''; //single quote char; or
F := #39;

Sql.add('insert into TSTTXT(TEXT) Values(' +
AnsiQuotedStr(Edit1.Text,F)')');
or
Sql.add('insert into TSTTXT(TEXT) Values(' +
AnsiQuotedStr(Edit1.Text,#39)')');

--
Robert

Quote
Magnus Grylle wrote in message <3b2f7ea0_2@dnews>...
>I have a problem when updating records in Oracle.
>I build a sql-statement:

>    close;
>    Sql.Clear;
>    Sql.add('insert into TSTTXT(TEXT) Values(' + F + Edit1.Text + F + ')');
>    ExecSql;

>This of course works well, ALMOST always. I have found that the subject
>content in edit1.text does not work. The combination of /: included between
>a pair of " " causes the statement to fail. Outside the double quote, it
>works fine.

>Any suggestions?

>I'm lost here.

>Magnus

Other Threads