Problem with VB replace function for CRLF...I think

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Problem with VB replace function for CRLF...I think

    I'm not sure if this is the best place for this post, sorry if it is
    not...

    Here is what I am doing:

    I have created a small kbase (SQL db) using VB and ASP. My record set
    is a SQL statement that queries the db (I am selecting 4 fields). I
    then write the rs to a table. I was able to figure out how to add the
    carriage returns and line feeds that are lost in html, however, for
    some reason 2 of the 4 fields are always written twice.

    For example, if my query result is A B C D, in other words, rs = A B C
    D, for lack of a better way, it is written in the table like below
    (table not shown):
    AA BB C D

    Obviously, it should be written as: A B C D

    I can't figure this out. For the record, there can never be a CRLF in
    the first two fields of the record set.

    Here is my code:

    <% Do while (Not oRs.eof) %>
    <tr>
    <% For Index=0 to (oRs.fields.count-1) %>
    <TD VAlign=top>
    <% = replace(oRs(Index),chr(13) & chr(10), "<br>")%>
    <% = oRs(Index)%>
    </TD>
    <% Next %>
    </tr>

    <% oRs.MoveNext
    Loop
    %>

    Since I know that I am selecting 4 fields, I can remove the for-loop
    and manually write the output. Of course, if I do it this way and I
    do not use the replace function at index 0 & 1 it works. I would like
    to get this figured out so I can use the replace function in other
    areas (where I am currently having the same problem).

    Any ideas/thoughts/comments would be appreciated!

    thanks,
    Chris
    Chris Guest

  2. Similar Questions and Discussions

    1. Replace function
      Please help, I want to replace a string within field in a table with a nother string. I am using the replace function but I am doing something...
    2. Trouble using Replace() function in CFN file
      I don't do much scripting in coldfusion besides some of the very basics for trasfering info from the database, so I'm not sure how to write this.......
    3. Search & Replace Function?
      I have some textfield that users will enter data into on my web site and then I'll use php and write it to mysql - for security purposes, is there...
    4. Using Replace function to remove two different characters
      I'm using replace function to strip 0s from a particular string: <%=replace(rs1("racelength"),"0","''"%> but I need to also strip empty spaces...
    5. Text Replace function
      Hi - I'm using the replace function to hilite search words in text which is returned. However, as the text which is being searched also includes...
  3. #2

    Default Re: Problem with VB replace function for CRLF...I think

    "Chris" wrote:
    : <% = replace(oRs(Index),chr(13) & chr(10), "<br>")%>
    : <% = oRs(Index)%>

    Why do you need both of these lines? Except for the replace function,
    they're the same. Do you have data for all fields in all rows?

    --
    Roland

    This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose.
    -Technet Knowledge Base-
    [url]http://support.microsoft.com/default.aspx?scid=fh;EN-US;kbhowto&sd=TECH&ln=EN-US&FR=0[/url]
    -Technet Script Center-
    [url]http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp[/url]
    -MSDN Library-
    [url]http://msdn.microsoft.com/library/default.asp[/url]




    Roland Hall Guest

  4. #3

    Default Re: Problem with VB replace function for CRLF...I think

    Awesome...thanks for the help.

    "Roland Hall" <nobody@nowhere> wrote in message news:<uv9S7sd1DHA.1740@TK2MSFTNGP12.phx.gbl>...
    > "Chris" wrote:
    > : <% = replace(oRs(Index),chr(13) & chr(10), "<br>")%>
    > : <% = oRs(Index)%>
    >
    > Why do you need both of these lines? Except for the replace function,
    > they're the same. Do you have data for all fields in all rows?
    >
    > --
    > Roland
    >
    > This information is distributed in the hope that it will be useful, but
    > without any warranty; without even the implied warranty of merchantability
    > or fitness for a particular purpose.
    > -Technet Knowledge Base-
    > [url]http://support.microsoft.com/default.aspx?scid=fh;EN-US;kbhowto&sd=TECH&ln=EN-US&FR=0[/url]
    > -Technet Script Center-
    > [url]http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp[/url]
    > -MSDN Library-
    > [url]http://msdn.microsoft.com/library/default.asp[/url]
    Chris Guest

  5. #4

    Default Re: Problem with VB replace function for CRLF...I think

    "Chris" wrote:
    : Awesome...thanks for the help.

    You're welcome. (O:=

    Roland


    Roland Hall Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139