carriage returns from dbase to html

Results 1 to 6 of 6

Thread: carriage returns from dbase to html

  1. #1
    Shawn P Guest

    Default carriage returns from dbase to html

    Problem: I have entered in data into a text field in a dbase with carriage returns present. I want to now read this back into html using asp with the end of line characters present (reading the field into a string terminates all EOL characters). Can this be done? If so, how?

  2. #2
    Nathan Pond Guest

    Default RE: carriage returns from dbase to html

    The problem isn&#039t in the database recordset retrieval. All of your fields will be returned correctly with line feeds in place. The problem is in the HTML, HTML doesn&#039t pay any attention to any spaces more than 1, or line feeds. It keeps writing text until it needs to wrap or it comes to a tag that tells it to do otherwise. (If you view the source of your page you&#039ll see the line feeds exactly where they should be in the text)<BR><BR>Now, most linefeeds stored in the database are really just 2 whitespace characters, chr(13) and chr(10). So if we replace every instance of that with a <BR> tag, it should do the trick.<BR><BR>MyTextVar = rs("My text")<BR>vbCrLf = chr(13) & chr(10)<BR>MyTextVar = Replace(MyTextVar, vbCrLf, "<BR>")<BR><BR>Response.Write MyTextVar<BR><BR><BR>Hope I helped, let me know if it doesn&#039t work or you have any questions.<BR><BR>Nathan

  3. #3
    Shawn P Guest

    Default RE: carriage returns from dbase to html

    Nathan,<BR><BR>the code works, but what is the carriage return character for HTML? <BR><BR>this code doesn&#039t co-operate with asp/html pages:<BR>MyTextVar = Replace(MyTextVar, vbCrLf, " (* is this where you are supposed to place in the carriage return *)<BR>")<BR><BR>if i put something in the string it works like a charm, but i need the carriage return...<BR><BR>sp

  4. #4
    Nathan Pond Guest

    Default RE: carriage returns from dbase to html

    I don&#039t understand what you are trying to do. The Carriage Return in HTML is the <BR> tag. Let me know of what you want and I&#039ll see what I can do.<BR><BR>Nathan


  5. #5
    Shawn Pollock Guest

    Default RE: carriage returns from dbase to html

    i couldn&#039t see the html tag you placed in your answer...it works great when it&#039s placed in my code...much appreciated...<BR><BR>sp

  6. #6
    Nathan Pond Guest

    Default RE: carriage returns from dbase to html

    Oh, my apologies, I didn&#039t even see the the web board didn&#039t post my note correctly. Glad everything works for you now though.

Posting Permissions

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