Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Save linefeed-return charactes in a varchar column

Author  Topic 

johnsql
Posting Yak Master

161 Posts

Posted - 2006-08-25 : 10:42:21
Hi,
I have use a HTML control TextArea to let users input free format text in it. Users can input save linefeed-return charactes (next line characters) in that textbox. But when I saved it in a varchar-datatyped column of a db table, those characters are saved as space blank characters. So, how can I save linefeed-return charactes in that varchar-datatyped column?
Thanks.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-08-25 : 10:57:58
In which format you want to store them?

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-08-25 : 12:22:51
Are you sure they are being saved as blanks? If you take that text and display it in another web page the line feeds won't display because line feeds don't display in HTML, not because they are not saved in SQL Server.

I do this and the text is saved exactly as it comes in from the textarea. When I display the text I replace line feeds with HTML <br> tags (I don't put the tags into the text in the database).
Go to Top of Page

johnsql
Posting Yak Master

161 Posts

Posted - 2006-09-06 : 16:16:01
snSQL,
To show sql-server-extracted string (via dataset, row, column..) to an textarea on an aspx page, how do you asp.net (C#,VB.NET) to track the linefeed-return characters you load from SQL Server a storage string? I know how to use C# like myString.Replace(trackedCharacter, "<br>"); but what is trackedCharacter?
I save whatever I input in the textarea into a varchar-type column of a SQL server table.
Thanks.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-06 : 20:51:38
When display the text at front end use

Replace(string,char(10),"<br>")

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-09-07 : 11:43:45
For C# use "\n" and for VB.NET use vbCr as the value to replace.
Go to Top of Page
   

- Advertisement -