Detecting the lenght of a MEMO field retrieved from a SQL database

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

  1. #1

    Default Detecting the lenght of a MEMO field retrieved from a SQL database

    Hi

    using VBScript, SQL, ASP I would like to show the contents of a memo
    field but only if it is not empty. I can do this with regular text
    fields, but not a memo field. So something like:

    sCommand = "SELECT aMemoField FROM aTable"
    set sDetails=conn.execute(scommand)
    if sDetails(0)<>"" then
    %>..<%=sDetails(0)%><br>
    <%end if%>

    but this does not work with a memo field.
    Can anyone please help??
    Thanks
    Ken


    *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Ken Lomax Guest

  2. Similar Questions and Discussions

    1. Lenght of NText field
      I have been using MSAccess databases when working with CF for the past 8 years. The following query or something very much like it has been hugly...
    2. SQL Where lenght of data in field GT 'n' characters
      Need a sql where statement to pull only records where field 'ABC' contains more than 2 characters (nvarchar 255 field)
    3. Exception error querying Access database from ASP page... Memo field type?
      Hi! Working with an MS Access database from an ASP webpage and I'm getting an Exception error... Error Type: (0x80020009) Exception...
    4. How to get the lenght of an Access database using ADOX
      I want to administer a remote Access database using ASP. I use the ADOX setup. I am able to list the tables, the fields in each table, the field...
    5. Detecting MEMO field
      Hi all, i'd like to know if there is some way to detect whether a field is of type MEMO (i'm using MS Access) so to behave accordingly placing a...
  3. #2

    Default Re: Detecting the lenght of a MEMO field retrieved from a SQL database

    Ken Lomax wrote:
    > Hi
    >
    > using VBScript, SQL, ASP I would like to show the contents of a memo
    > field but only if it is not empty. I can do this with regular text
    > fields, but not a memo field. So something like:
    >
    > sCommand = "SELECT aMemoField FROM aTable"
    > set sDetails=conn.execute(scommand)
    > if sDetails(0)<>"" then
    > %>..<%=sDetails(0)%><br>
    > <%end if%>
    >
    > but this does not work with a memo field.
    What does "does not work" mean? Error message? Incorrect result?

    I normally use the len() function with all strings instead of comparing to
    "". Your logic is missing a step however: you should test for EOF before
    attempting to read the contents of a Field (why not use the more
    straightforward "rs" for your recordset variable?):
    if not sDetails.EOF then
    if len(sDetails(0)) > 0 then
    ...
    end if
    end if

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows [MVP] Guest

  4. #3

    Default Re: Detecting the lenght of a MEMO field retrieved from a SQL database

    Is it MEMO in Access, or TEXT in SQL Server? SQL Server doesn't have a MEMO
    datatype.

    What does "does not work" mean?

    Have you read:

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

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Ken Lomax" <kennethlomax@hotmail.com> wrote in message
    news:#bFOOrTTEHA.2544@TK2MSFTNGP10.phx.gbl...
    > Hi
    >
    > using VBScript, SQL, ASP I would like to show the contents of a memo
    > field but only if it is not empty. I can do this with regular text
    > fields, but not a memo field. So something like:
    >
    > sCommand = "SELECT aMemoField FROM aTable"
    > set sDetails=conn.execute(scommand)
    > if sDetails(0)<>"" then
    > %>..<%=sDetails(0)%><br>
    > <%end if%>
    >
    > but this does not work with a memo field.
    > Can anyone please help??
    > Thanks
    > Ken
    >
    >
    > *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    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