SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Using Len

  1. #1
    SitePoint Zealot frosco's Avatar
    Join Date
    Jul 2003
    Location
    WA state
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using Len

    I'm still learning ASP so I'm not sure what to search for, aside from Len and Str. Couldn't find the answer.

    All of the other fields work fine with this, but this is a larger memo (?) field--text area I guess you'd call it.

    This is the code

    Code:
    <%
    'Optional Comments Field
       if Len(rsGuestBook("Comments" )) > 1 then
    %>
       <tr>
         <td>Comments</td>
         <td>
    <%
     =rsGuestbook("Comments")
    %>
         </td>
       </tr>
    
    <%
      end if
    %>

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the problem?

  3. #3
    SitePoint Zealot frosco's Avatar
    Join Date
    Jul 2003
    Location
    WA state
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry--I knew I forgot something. The problem is that the information from the recordset doesn't show, its just blank. No error messages or anything.

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im a bit confused...but, you don't have any code to print any information from the recordSet above.

    somethin like...

    response.Write rsGuestbook("Comments")

    ..would print the comments column if it was not null

  5. #5
    SitePoint Zealot frosco's Avatar
    Join Date
    Jul 2003
    Location
    WA state
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought that too, but it was working in that format with all of the other fields. But, I gave it a try and it worked:
    Code:
    <%
    'Optional Comments Field
        comments=(rsGuestbook("Comments"))
        if Len(comments) > 1 then
    %>
        <tr>
          <td>
             Comments
          </td>
          <td>
             <% response.write comments%>
           </td>
        </tr>
    <%
    end if
    %>
    Thank you!!

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is an = in front of rsGuestbook...

    I think it needs to be on the same line as <% though....ie
    <%=rsGuestbook.Fields("Comments")%>

  7. #7
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Is the word "Comments" appearing on the page? If it does then the record is blank.

  8. #8
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what happens if you actually put it in a textarea?

    Code:
    <%
    'Optional Comments Field
       if NOT isNull(rsGuestBook("Comments"))  OR NOT isEmpty(rsGuestBook("Comments")) THEN
    %>
            <textarea name="comments" cols="20" rows="5" readonly><%=rsGuestbook("Comments")%></textarea>
         
    <%
      end if
    %>


Bookmarks

Posting Permissions

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