473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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>
'$$$$$
Jul 19 '05 #1
2 1904
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.
Jul 19 '05 #2
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!
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kingdom | last post by:
I Need some serious help here. strugling novis with ASP and javascript any help would be greatly appreciated The script below does exactly what I want it to do for each product on the two passes...
12
by: jason | last post by:
Access 2000: I have a customer-inventory table I need to loop through and compile a list of all the inventory items the customer is tracking. The problem I am finding is that a simple loop...
4
by: ptrlks | last post by:
Hi again, the problem is in this code:ElseIf Right(rsBokad("aktivitet"), 3) = "Cup" Then dStartDate = Cdate(rsBokad("startDatum")) dEndDate = Cdate(rsBokad("endDatum"))
1
by: Henry C. Wu | last post by:
Hi all, I was wondering how can I loop through all the database in a particular server using ADODB into a combobox? Below is the code I tried using but didnt work, any hints/solutions for this...
12
by: eyoung | last post by:
Can someone tell me what I've done wrong here...this kinda works...but no cigar! I want to loop threw each "Service Number" and get all entries before going on to the next. What looks something...
7
by: Jerry | last post by:
I'm trying to execute a stored procedure in a loop while paging through database table records but the stored procedure isn't running. I get the folowing error: The component 'adodb.connection'...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
4
by: keithsimpson3973 | last post by:
Hi. I have a loop that was written for me by some outstanding programmers here (willakawill and killer42). It works great if I only select one record to check for duplicates. The user can pick on one...
8
by: Kandar7272 | last post by:
Hi - I'm trying to work out a way to loop through (or just get a list of) all of the tables in an SQL Server (2005) database from Access. Based on the name of the table, I will then proceed to do...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.