Results 1 to 3 of 3

Thread: [2005] how to solve new line problem with sql server 2005

  1. #1

    Thread Starter
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    [2005] how to solve new line problem with sql server 2005

    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

  2. #2

    Thread Starter
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    Re: [2005] how to solve new line problem with sql server 2005

    anybody ???

  3. #3

    Thread Starter
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    Re: [2005] how to solve new line problem with sql server 2005

    is it very hard ? ? ? ?

    dont let me down guys )-:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width