SSIS Script Component add carriage return to string for NTEXT

I have a script component where I'm concactenating several strings then inserting the resultant string into a DT_NEXT field.  So I have something like this (s is the string).

if (!Row.chkenvironmentaldatapres_IsNull && !String.IsNullOrWhiteSpace(Row.chkenvironmentaldatapres.ToString()))
            s = s + "Environmental data pres: " + Row.chkenvironmentaldatapres.ToString() + Environment.NewLine;

        if (!Row.smokestatuscode_IsNull && !String.IsNullOrWhiteSpace(Row.smokestatuscode.ToString()))
            s = s + "Smoke status code: " + Row.smokestatuscode.ToString() + Environment.NewLine;

        if (!Row.txttobaccocessdiscuss_IsNull && !String.IsNullOrWhiteSpace(Row.txttobaccocessdiscuss.ToString()))
            s = s + "Tobacco cessation discuss: " + Row.txttobaccocessdiscuss.ToString() + Environment.NewLine;



    private byte[] GetBytes(string str)
        byte[] bytes = new byte[str.Length * sizeof(char)];
        System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
        return bytes;


Open in new window

The problem is the Environment.Newline isn't working.  My text shows up in the application looking like this:

Categorye One:  Patient Presents with this
Category Two: Patient Presents with this&#x0D

I should be seeing:
Category One:  Patient presents with this

Category Two:  Patient presents with this

What should I be using besides Environment.Newline?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ValentinoVBI ConsultantCommented:
Instead of using a regular String object and && for concatenation I'd consider using the StringBuilder class. It has methods such as Append() and AppendLine() (which adds a CLRF automatically).

More details: StringBuilder Class

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.