Hello,

I'm new in ASP.NET environment.

I'm using text boxcontrol with multiline properity to add description of product into my MS access database.

My question is, when I print the data from DB the description is printed in one line not in multiple lines!!!

How to solve this problem?

Can anyone help? :(

All you are storing in the DB is the string. It will only have newlines in the DB column if you insert newline characters (vbCrLf, vbNewLine are used in Access).

So if you hit return in the textbox to create a new line I think you will see '/n'. Find these, replace them with vbCrLf or vbNewLine and this should retain the newlines into the DB.

another way is to store it as html.

C#

using System.Text;

 protected void Button1_Click(object sender, EventArgs e)
    {
        //string builder is used to manipulate the string data
        StringBuilder sb = new StringBuilder();
        //assign text to string builder in order to manipulate it
        sb.Append(TextBox1.Text);
        // \r\n  represents carriage return or newline
        sb.Replace("\r\n", "<br/>");
       // now store sb in database
        Response.Write(sb);
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.