how to show part of a field?

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

  1. #1

    Default how to show part of a field?

    I have a web page with messages.
    I want to show the list of the messages only with part of them, for example
    the first 30 letters/characters.
    Now I use this string:

    <%response.write rs("msg") %>

    and it shows obviously the whole field (msg)

    Which could be the right syntax?
    Thanks,
    Gianfranco


    Mr Jahnfree Guest

  2. Similar Questions and Discussions

    1. bitmap inside canvas, do not show outside part
      Hi, I have a canvas object in my app: <mx:Canvas id="canvas".../> Then in my actionsript, I use the following code to show a bitmap: var...
    2. only show part of a dynamic text field
      ok i have this description field put in dynamically on my site but i only wnat the first 120 chars to show and thne ill put a link saying click here...
    3. How to show added on visible part of data grid.
      hi, I met a problem. There is a data grid, I can add new item on it. At beginning, there are little items on data grid, so you can see all of...
    4. using php to show particular part of page
      I have a particular section of a page that I need to display if the variable being passed is a certain name. The the particular block of code that...
    5. Part field Use
      I am trying to set up a field which uses two different field togethe for a new number. That part is no problem. however I have a field with 6...
  3. #2

    Default Re: how to show part of a field?

    "Mr Jahnfree":
    : I have a web page with messages.
    : I want to show the list of the messages only with part of them, for
    example
    : the first 30 letters/characters.
    : Now I use this string:
    :
    : <%response.write rs("msg") %>
    :
    : and it shows obviously the whole field (msg)

    <% Response.Write left(rs("msg"),30) %>
    or
    <%= left(rs("msg"),30) %>

    --
    Roland Hall
    /* 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 Script Center - [url]http://www.microsoft.com/technet/scriptcenter/[/url]
    WSH 5.6 Documentation - [url]http://msdn.microsoft.com/downloads/list/webdev.asp[/url]
    MSDN Library - [url]http://msdn.microsoft.com/library/default.asp[/url]


    Roland Hall Guest

  4. #3

    Default Re: how to show part of a field?

    You can also try to truncate the result set before it is even returned from the database. Assuming you are not using the full message text on the same page as you are displaying the summary, this could save some unnecessary data transfer. You could modify your SQL as follows

    SELECT LEFT(msg, 30) As msg FROM tblMessage

    If you use both a summary and the full text on the same page, it is better to use the VBScript function to truncate the message. But if not, letting the database truncate it for you should perform better and reduce the amount of data sent accross the network

    Good luck

    Joh


    John Scragg 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