Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:08 PM
Perry Reynolds
Guest
 
Posts: n/a
Default do while loop during ADODB connection

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  
Old July 19th, 2005, 01:08 PM
[ + 2 0 r p 3 ]
Guest
 
Posts: n/a
Default RE: do while loop during ADODB connection

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.
  #3  
Old July 19th, 2005, 01:08 PM
Perry Reynolds
Guest
 
Posts: n/a
Default RE: do while loop during ADODB connection

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!
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles