'Text' data type returned differently between ASP & Query Analyzer

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

  1. #1

    Default 'Text' data type returned differently between ASP & Query Analyzer

    I have the SQL 2000 server with a database table having one 'text' data type column. This column stores the general text message (normally body of the email message) which the thrid party application inserts in

    I wanted to query this column and display on the html page using ASP

    The ASP code returned the data in the column in the continued text which has no linebreaks at all, and the result format is not readble. I copied the text displayed on the returned page onto the notepad then opened with the hex editor to see the text in raw format, and found none of char13, char 10 nor any char which may identify the linebreak. It seemed to me there are no linebreaks or any identifiers to the linebreaks for the data returned from the ASP comparing to the original text

    I then tried query the same column from the Query analyzer. I copied the result returned from the query analyzer into the notepad. I then opened it with the hex editor to see what it contains in raw format,and I found there were char code 20 (space char) instead. I noticed that 2 spaces char code indentify the line break in which they substitue one line break when comparing to the original text

    my questions

    - Why the result returned in ASP has no linebreak indentifiers like the result returned from the query analyzer ( 2 spaces char)
    - What would be the way to query the data from the 'text' data type column and display correctly as the original text format

    I used the common basic asp code as belo

    <%@ Language="VBScript"%><
    strSQL = "Select Body from main
    set conn = Createobject("ADODB.Connection"
    conn.open "Provider=SQLOLEDB;Data Source=Pluto;Initial Catalog=Message;Integrated Security=SSPI
    set rs = conn.execute (strSQL
    rs.MoveFirs
    Do While Not rs.Eo
    %><tr><td>Body= </td><td><%=rs("Body")%></td></tr><
    rs.movenex
    Loo
    rs.clos
    conn.clos

    Many thanks in advance
    suksawat Guest

  2. Similar Questions and Discussions

    1. How to set the value of a variable to some data returned from a query
      Hi everybody, After I make a query and get results back, is there an easy way to do something like: <cfset some_var = "a value from the xth...
    2. sql statement works in query analyzer but not in asp/ado?
      I am new to asp/ado (well and sql server)... this has been driving me mad for hours now. I have created an SQL statment using access query design. I...
    3. Generate Table script from query analyzer...
      You can use SQL-DMO to do that but not straight tsql. -- Andrew J. Kelly SQL Server MVP "Robert Taylor" <robertt@rtnetworks.com> wrote...
    4. Data type query
      Hi I have to specify in a table certain values for: Minutes duration spent on phone-eventduration, the eventdate-which date, and event time- exact...
    5. BCP query out executed by xp_cmdshell works fine from query analyzer but fails from VB Component
      Hi all, I have a stored procedure which returns a vast number of record and i have to write the output into a csv file. I'm using BCP utility to...
  3. #2

    Default Re: 'Text' data type returned differently between ASP & Query Analyzer

    > The ASP code returned the data in the column in the continued text which
    > has no linebreaks at all, and the result format is not readble.
    Yes, because plain text and HTML are not identical!

    Imagine if you created an HTML page and every single line break was
    interpreted that way? We'd either have very ugly web pages or HTML code
    that was impossible to maintain.

    You need to replace plain text carriage returns with HTML tags that
    represent and display carriage returns.

    [url]http://www.aspfaq.com/2188[/url]

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]
    (Reverse e-mail to reply.)


    Aaron [SQL Server MVP] 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