Dear all,
i have a database table the holds rtf contents, we want to transform all this rtf fields to plain text.

we have tried the following :
Code:
dim cn as new sqlconnection(connectionstring)
dim cmd as new sqlcommand("select bodystr,serial from files",cn)
try
cn.open
dim readx as sqldatatreader = cmd.executereader
do while readx.read
'transforming rtf to plain text
dim rtf1 as new system.windows.forms.richtextbox
rtf1.rtf = readx!bodystr
dim newPlainStr as string = rtf1.text
'updating back to database
dim cn2 as new sqlconnection(coonnectionstring)
dim cmd2 as new sqlcommand("update files set bodystr = @bodystr where serial= @serial",cn2)
with cmd2.parameters
.addwithvalue("@serial",readx!serial)
.addwithvalue("@bodystr",newplainstr)
end with
'executing update
cn2.open
cmd2.executenonquery
cn2.close
next
cn.close
catch ex as exception
'log error to log file
finally
'code to clean up database connection
if not isnothing(cn) then
 if cn.state = open then cn.close
end if
end try

sorry for this long code, in fact this code works but when i save back to the database in the update command ( Sql server 2005), i lose all the carriage returns. (it means if i have 5 lines, it compacts them into one line without new line separator).

what am i missing here, what should i do to solve this problem


thank you