do while loop during ADODB connection

Discussion in 'ASP General' started by Perry Reynolds, May 5, 2004.

  1. Hi,

    I am writing a script to send customers an email copy of their
    shopping cart recipt. While creating the variable "mailbody" which
    will be plugged into my CDO.htmlbody, I need to gather some
    information about their order. The script does a "Do while not
    rs.eof" and assigns each rs(field) to a variable, which is then added
    to the mailbody variable. Unfortunately, when i ask for the mailbody
    variable later, I lose all of the information added to the variable
    during my loop. I've tried everything I can think of to correct this
    so I was hoping somebody out there would have some ideas. Is there a
    better way of doing this? Script is included below.

    Thanks,

    Perry


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    mailbody = mailbody & "</tr>"

    '$$$$$
    '<problem area>
    '$$$$$

    If Not rs.EOF Then
    rs.MoveFirst
    rs.PageSize = NrPerPage
    TotalPages = rs.PageCount
    rs.AbsolutePage = CurrentPage

    trow="#FCFBFF"

    Do while not rs.eof and Count1 < rs.PageSize

    emorderno=rs("orderno")
    emcustomer=rs("customer")
    emadate=rs("adate")
    empartno=rs("code")
    emqty=rs("qty")
    emshipcode=rs("shipcode")
    emusername=rs("username")
    emdescr=rs("description")
    if len(emdescr)>30 Then
    emdescr=Left(emdescr,30) & "..."
    end if

    mailbody = mailbody & "<tr><td bgcolor='" & trow & "'><img border='0'
    alt='" & txt & "' src='http://www.rubber-seal.com/cart3/img/" &
    emstatus & ".gif'></td>"
    mailbody = mailbody & "<tr><td></td></tr><td bgcolor=" & trow& ">" &
    emcode
    mailbody = mailbody & "<font color='#6699FF' title='" &emcomment& "'
    size='1'>"
    mailbody = mailbody & " " & left(comment,50) & "</font></td>"
    mailbody = mailbody & "<td bgcolor=" &trow& " align='center'>" &emqty&
    "</td>"


    count1=count1+1

    if trow="#FCFBFF" Then
    trow="#FFFFFF"
    Else
    trow="#FCFBFF"
    End if

    rs.movenext
    loop
    end if
    rs.close


    '$$$$$
    '</problem area>
    '$$$$$
    Perry Reynolds, May 5, 2004
    #1
    1. Advertising

  2. where is your sql statement? if your only pulling one record from the databse you dont need a loop at all. also, the recordset paging can go. i also dont see anywhere in your mailbody where you tryi and use these variables. they should contain there values, your just not using them.
    [ + 2 0 r p 3 ], May 5, 2004
    #2
    1. Advertising

  3. ooops. not enough coffee. i had some old variables in the mailbody.
    thanks for the wake-up. i still have the same problem however. i do
    need the loop because each time it loops it is adding the line items of
    their order (part number, description, quantity, etc.) to the
    mailbody...

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Perry Reynolds, May 5, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PJ
    Replies:
    1
    Views:
    1,792
    George Ter-Saakov
    Oct 30, 2003
  2. Steven

    while loop in a while loop

    Steven, Mar 24, 2005, in forum: Java
    Replies:
    5
    Views:
    2,230
    Tim Slattery
    Mar 30, 2005
  3. Uday Bidkar
    Replies:
    4
    Views:
    489
    =?ISO-8859-15?Q?Juli=E1n?= Albo
    Dec 12, 2006
  4. A@Rome
    Replies:
    1
    Views:
    119
    A@Rome
    Dec 9, 2004
  5. Isaac Won
    Replies:
    9
    Views:
    372
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page