problem of saving multiline text into SQL table
-
Hi, I need to save a multiline text into a SQL table. I use the fiedl type is Text. I found that the multiline mode is not maintained after saving into table, that is to say, all the text become only one line. thenn when this text is displayed in a view control such as datalist, then it is a very long text line, obviously, not good! how to treat this problem? thanks.
-
Hi, I need to save a multiline text into a SQL table. I use the fiedl type is Text. I found that the multiline mode is not maintained after saving into table, that is to say, all the text become only one line. thenn when this text is displayed in a view control such as datalist, then it is a very long text line, obviously, not good! how to treat this problem? thanks.
Try to replace the string that your are showing on text box using BR like, string strAddress= strAddress.Replace("\r\n", "<BR>"); Hope this may helps you :)
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Hi, I need to save a multiline text into a SQL table. I use the fiedl type is Text. I found that the multiline mode is not maintained after saving into table, that is to say, all the text become only one line. thenn when this text is displayed in a view control such as datalist, then it is a very long text line, obviously, not good! how to treat this problem? thanks.
A simple newline puts character 13 on the input. So if you store it in the database it will hold only character 13(\n) In case you show in DataList, the formatting is done using HTML, so you need <br/> to have new line. Replace \n\r with <br/> and it will work.
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.