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 2005 Forums
 SQL Server Administration (2005)
 text inserting problem

Author  Topic 

quarinteen
Starting Member

40 Posts

Posted - 2007-10-21 : 16:21:32
I fixed all the free text stuff but now I have another problem. I created a web app one page to enter data and anoter to display it. I have a multiple row text box and if you enter something with returns it it when you display the data it ignores the returns and puts everything on the same line BTW the column type is text



example



this

"want to hest this out.

========================



now I am going to put in some test data and see how it comes out



finished"



will come out like this

"want to hest this out.========================now I am going to put in some test data and see how it comes out finished"



how do you fix this?

Kristen
Test

22859 Posts

Posted - 2007-10-21 : 21:35:31
Presumably this is just that you have no formatting in your HTML?

If you do VIEW SOURCE on your HTML do you see the line breaks? If so you need to put some formatting in - e.g. <br> in place of Linebreaks.

Kristen
Go to Top of Page

quarinteen
Starting Member

40 Posts

Posted - 2007-10-21 : 21:58:47
If I put <br> in it then when someone searches for something the <br> will just show up in the column.

It is a text box that inserts data into a database.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-22 : 04:07:05
No, you don;t want to put <br> in the stored data. Store what the user gives you. But if you want to display it with line breaks in HTML you will have to put <br> in.

I recommend that you consider this as a presentation issue, not a database issue.

Kristen
Go to Top of Page

quarinteen
Starting Member

40 Posts

Posted - 2007-10-22 : 09:26:12
How do I determine where the user puts in the carriage returns???
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-22 : 09:39:34
REPLACE(REPLACE(REPLACE(Col1, CHAR(10), ' '), CHAR(13), ' '), ' ', ' ')



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

quarinteen
Starting Member

40 Posts

Posted - 2007-10-23 : 10:30:33
is this c# or sql I am not a big programmer.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-23 : 12:31:07
"is this c# or sql I am not a big programmer"

There is usually a REPLACE style function in any language which goes something like:

REPLACE(TheText, ThingToFind, TextToReplaceItWith)

The one above will work in SQL (but it isn't going to put any <BR> in Natch!), I would expect C# to not understand CHAR(10), although VB/NET should.

Kristen
Go to Top of Page
   

- Advertisement -