May 9, 2014 at 7:38 am
One purchased app stored user's multiple lines input into a varchar column in which including char(13) and char(10).
My app need to select this value and format to multiple lines text in one text box.
How to code to output it?
May 9, 2014 at 8:12 am
your application would handle the CrLf automatically, with zero changes, as long as you are using the right object;
in C#.Net Windows Application,in a windows app, you'd could use System.Windows.Forms.Label,System.Windows.Forms.TextBox with the Property Multiline = True, or a System.Windows.Forms.RichTextBox;
in a web application, you have to use a <Textarea> object, and not an <input type="text"
WPF is the same idea, but i don't remember the object off the top of my head.
what is your target applicaiton's platform?
Lowell
May 9, 2014 at 8:12 am
For example, user may input text like below.
Welcome to Order application
Your registration is completed
Using code to store above text into SQL column is
'Welcome to Order application' + char(13) + char(10) +'Your registration is completed'
But, if you open this column, you will see as below
Welcome to Order application Your registration is completed
How to code to read text and display like
Welcome to Order application
Your registration is completed
May 9, 2014 at 8:14 am
I am working with ASP.NET
May 9, 2014 at 8:18 am
Thank you for your point.
Once I change text box form single line to multiple lines mode, it works great without one code.
May 9, 2014 at 8:18 am
Your app (on the frontend) needs to replace the CHAR(10) and CHAR(13) characters from the stored value to the linefeeds used by this app. Most applications handle this stuff automatically correct. If you execute the sample below in SSMS in GRID mode, you'll see the results (from the SLECT) in a single line cel but on the message tab you see the results (from the PRINT) as multiple lines. If you execute this sample in TEXT mode, you see both results as multiple lines.
set nocount on
declare @line nvarchar(50)
set @line = 'line 1' + CHAR(10) + CHAR(13) + 'line 2'
select @line
print @line
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply