views:

86

answers:

4

Can anybody tell me how to save newline in database and also retrieve it in a same manner using asp.net.

A: 

you can try \r\n or \n

Gaurav Srivastava
+1  A: 

You can use System.Environment.NewLine in .Net to save the newline. If you simply press enter I think SQL saves it as \r\n.

Sidharth Panwar
+5  A: 

SQL Server does no processing at all to data sent in. If you send this

aaa
bbb

ccc

Then this is exactly what is stored, complete with characters 13 and 10

If you are having problems, then it's likely chars 13 and 10 do not get into SQL Server or the page is removing them because they are suppressed whitespace in HTML.

To summarise, the problem is almost certain not to be with SQL Server

gbn
A: 

You want to use FormView to submit to a database?

http://sfvt.wordpress.com/2010/09/06/asp-net-tutorial-formview-insert-to-database/

Jamie