line breaks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have an sql database with some text (nvarchar) fields. The problem is that
if I get those fields with a datareader (dr.getstring(0)) an then I save text
in a txt file I loose all the line breaks. If I open database Studio
Management I see fields like this:

Això és una proba pel texte sql.

Els canvis de línia no es controlen bé

Instead of this line break you see now when a copy/paste text I see small
squares as characters in the database.

I don't know how to keep line breaks when I save text on a txt file...

Any Help?


Thanks

Juan Puebla
Barcelona (Spain)
 
The database doesn't change the line breaks at all. They are just plain
characters like any other. When you read the values from the database
you will get them exactly as they were entered in the database.

What are you using to view the text files?

From where does the data come originally?
 
Can you add the line breaks back into the string array lines when you save to
a text file?
 
Finally I found a solution. I found out that the character that is breaking
lines is the constant "vbLf". I just have to split the string using this
character and then: TextStreamWriter.writeline

I don't know if it's the best solution but it works!

Thanks to all for your replies!

Juan
(Barcelona)
 
You can replace the vbLf string with the string you need for the line
break. Use vbCrLf if you need that specific combination, or
Environment.NewLine if you need the combination used by the current system.
 
Back
Top