do while loop during ADODB connection

P

Perry Reynolds

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>
'$$$$$
 
2

[ + 2 0 r p 3 ]

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.
 
P

Perry Reynolds

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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top