开发者

Preserve new line characters of data from TextBox to SQL Server

I am using Multi-line TextBox through which users will be able to enter data which will be saved on to the SQL Server 2008 database. There is an other process, which reads this data from the table and writes to a text file.

Problem: If the data entered by users in text box contains <Enter> from keyboard, it is saving to the database with some spaces replacing the <Enter>.

Some how if I read the same data to a text box on webpage, it is being displayed properly.

But, if my second process that reads the data from database and prints to a text file, it is not keeping the text format properly. It is not retaining the <Enter> in the data bei开发者_高级运维ng printed to text file.

Can any one help me how to retain the <Enter> in the text file being generated?


It sounds like your <Enter> is being retained in the database since it works correctly when you output to the textbox again.

My guess is that the problem is either in the process writing them to the textfile stripping out CR and LF characters or your text reader isn't achknowledging them.

If you open the text file in Notepad++ and then go to view --> show symbol and make sure "Show End of Line" is checked you should be able to see if the CR and LF characters at the end of the line are preserved when written to the text file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜