By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,351 Members | 1,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,351 IT Pros & Developers. It's quick & easy.

line breaks

P: n/a
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)

Jun 10 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Juan,

Why do you than not use "Text" fields in your database?

Cor

"Juan Puebla" <Ju********@discussions.microsoft.com> schreef in bericht
news:19**********************************@microsof t.com...
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 lnia 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)

Jun 11 '06 #2

P: n/a
In any case the result is the same.

Juan

"Cor Ligthert [MVP]" wrote:
Juan,

Why do you than not use "Text" fields in your database?

Cor

"Juan Puebla" <Ju********@discussions.microsoft.com> schreef in bericht
news:19**********************************@microsof t.com...
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)


Jun 11 '06 #3

P: n/a
What is the character than that you are using?

Cor

"Juan Puebla" <Ju********@discussions.microsoft.com> schreef in bericht
news:B7**********************************@microsof t.com...
In any case the result is the same.

Juan

"Cor Ligthert [MVP]" wrote:
Juan,

Why do you than not use "Text" fields in your database?

Cor

"Juan Puebla" <Ju********@discussions.microsoft.com> schreef in bericht
news:19**********************************@microsof t.com...
> 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 lnia 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)
>


Jun 11 '06 #4

P: n/a
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?
Juan Puebla wrote:
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)

Jun 11 '06 #5

P: n/a
Can you add the line breaks back into the string array lines when you save to
a text file?
--
Dennis in Houston
"Juan Puebla" wrote:
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)

Jun 11 '06 #6

P: n/a
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öran Andersson" wrote:
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?
Juan Puebla wrote:
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)

Jun 11 '06 #7

P: n/a

You would better use environment.newline
regards

Michel Posseth [MCP]
"Juan Puebla" <Ju********@discussions.microsoft.com> schreef in bericht
news:CF**********************************@microsof t.com...
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)

"Gran Andersson" wrote:
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?
Juan Puebla wrote:
> 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 lnia 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)
>

Jun 11 '06 #8

P: n/a
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.

Juan Puebla wrote:
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öran Andersson" wrote:
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?
Juan Puebla wrote:
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)

Jun 12 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.