0

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?

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by djzia
0

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.

0

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);
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.