line breaks

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)
 
G

Guest

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?
 
G

Guest

Can you add the line breaks back into the string array lines when you save to
a text file?
 
G

Guest

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)
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top