Page 1 of 1

Azure, String parameter in TUniQuery lose line feed character

Posted: Wed 07 Jun 2017 11:56
by StefanDWC
Hello, i have a simple insert into statement which add a new record to a table.
Like :

Code: Select all

WorkerQuery.SQL.Text :=
    'INSERT INTO Activities (Duration, Text) VALUES (:Duration, :Text)';
WorkerQuery.ParamByName('Duration').AsInteger := 1;
WorkerQuery.ParamByName('Text').AsString := 'First line of text'+#13+'Second line of text';
WorkerQuery.ExecSQL;
However, if i read the Text column later via a SQL statement, get i one line of text only instead of the expected two lines. The #13 character is not more there.
if i use a TUniTable and a grid component to enter a multi line text, then work it as expected.

It seems that the #13 character will be removed before or while sending the script. If this is true, why?

Re: Azure, String parameter in TUniQuery lose line feed character

Posted: Thu 08 Jun 2017 08:06
by azyk
To solve the problem, use the sLineBreak constant instead of #13 . More details about it in Embarcadero documentation:
http://docs.embarcadero.com/products/ra ... Break.html

Re: Azure, String parameter in TUniQuery lose line feed character

Posted: Thu 08 Jun 2017 08:55
by StefanDWC
Thanks for you reply, Azyk.
My use of character #13 was only an example. Strings can be build from 256 differend character (#0..#255).
Every combination, including #0, should be possible in Delphi since the String data type have it's own field for the length.

However, the problem seems solved. I used another way to display the string data and all character was there, including #0.

Thanks.