Live Chat Icon For mobile
Live Chat Icon

How to maintain Line feeds when saving data to a database

Platform: ASP.NET| Category: ADO.NET

Save the data entered in the multiline textbox as

VB.NET


..
cmd.Parameters.Add(new SqlParameter('@Notes' ,SqlDbType.NVarChar ))
cmd.Parameters ('@Notes').Value ='<pre>' + TextBox1.Text   + '</pre>'
....
cn.Open()
cmd.ExecuteNonQuery()

C#


...
cmd.Parameters.Add(new SqlParameter('@Notes' ,SqlDbType.NVarChar ));
cmd.Parameters ['@Notes'].Value ='<pre>' + TextBox1.Text   + '</pre>';
....
cn.Open();
cmd.ExecuteNonQuery();

To retrieve the Data

VB.NET


Response.Write (ds.Tables(0).Rows(0)('Notes').ToString ())

C#


Response.Write (ds.Tables[0].Rows[0]['Notes'].ToString ());

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.