Home All Groups Group Topic Archive Search About
Author
10 Jun 2006 11:46 PM
Juan Puebla
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)

Author
11 Jun 2006 5:33 AM
Cor Ligthert [MVP]
Juan,

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

Cor

Show quoteHide quote
"Juan Puebla" <JuanPue***@discussions.microsoft.com> schreef in bericht
news:1927C558-AD2F-4370-B64E-960866219585@microsoft.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)
>
Author
11 Jun 2006 9:05 AM
Juan Puebla
In any case the result is the same.

Juan

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Juan,
>
> Why do you than not use "Text" fields in your database?
>
> Cor
>
> "Juan Puebla" <JuanPue***@discussions.microsoft.com> schreef in bericht
> news:1927C558-AD2F-4370-B64E-960866219585@microsoft.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)
> >
>
>
>
Author
11 Jun 2006 9:34 AM
Cor Ligthert [MVP]
What is the character than that you are using?

Cor

Show quoteHide quote
"Juan Puebla" <JuanPue***@discussions.microsoft.com> schreef in bericht
news:B77CB3A4-E6B1-4352-98BC-C55F2B945714@microsoft.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" <JuanPue***@discussions.microsoft.com> schreef in bericht
>> news:1927C558-AD2F-4370-B64E-960866219585@microsoft.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)
>> >
>>
>>
>>
Author
11 Jun 2006 11:35 AM
Göran Andersson
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:
Show quoteHide quote
> 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)
>
Author
11 Jun 2006 3:35 PM
Juan Puebla
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)

Show quoteHide quote
"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)
> >
>
Author
11 Jun 2006 3:51 PM
Michel Posseth [MCP]
You would better use environment.newline


regards

Michel Posseth [MCP]


Show quoteHide quote
"Juan Puebla" <JuanPue***@discussions.microsoft.com> schreef in bericht
news:CF078991-9020-4F65-B6A5-C4DAE257FCDE@microsoft.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)
>
> "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)
>> >
>>
Author
12 Jun 2006 4:23 PM
Göran Andersson
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:
Show quoteHide quote
> 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)
>>>
Author
11 Jun 2006 1:16 PM
Dennis
Can you add the line breaks back into the string array lines when you save to
a text file?
--
Dennis in Houston


Show quoteHide quote
"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)
>