Results 1 to 3 of 3

Thread: ASPMail - structuring problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Angry ASPMail - structuring problem

    Hello,

    I need to create an email which is sent using ASPMail, but I'm having
    trouble "structuring" the email properly.

    This is basically what I do....

    set rs = cn.execute (select * from products)

    while not rs.eof
    strbody = strbody & rs("prodname") & " " & rs("qty")
    rs.movenext
    wend

    I then send this with "Mailer.BodyText = strbody". My problem is the
    spacing - not all prodname's are the same length. I
    cannot now have a FIXED number of spaces between prodname & qty, because
    then all lines will not be aligned properly! I tried using len(prodname) and
    then work out how many spaces I need, but for some reason that does not
    want to work!!

    Any advice,
    T

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Are you using Len(rs.Fields("prodname"), because rs.Fields("prodname") might be evaluated to a pointer, in which the length would always be 4. Cast it to a string first, although in ASP everything is a variant anyway.

    VB Code:
    1. Dim strProdName
    2. ...
    3. strProdName = CStr(rs.Fields("prodname"))

    Then Len(strProdName) should work.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Red face Thanks Josh, I'll give it a try!!


Posting Permissions

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



Click Here to Expand Forum to Full Width