Solved

Looping Records from Database in HTML Email Notification ASP page

Posted on 2003-10-29
9
255 Views
Last Modified: 2010-04-17
The following piece of code is the only part I can't get to work in my shopping cart email notification. I am trying to pull the items in the cart table of an Access database and submit it in the email with HTML format.

Can anyone see what I am missing here?
Any help will be greatly apreciated.
You may need to copy the code and paste in an editor to see the format.
Gigabandit

DO WHILE NOT cRS.EOF

HTML = HTML &"<tr bordercolor=""#C9C0AB"" bgcolor=""#FFFFFF"">"
HTML = HTML &"<td><div align=""center"">"& cRS("Ctquantity") & "</div></td><td><div align=""center"">" & cRS("Ctsize") & "</div></td><td><div align=""center"">"& cRS("Ctcolor") &"</div></td><td><div align=""center"">"& cRS("Ctembroideropt")&"</div></td><td><div align=""center"">"& cRS("Ctproductname") &"</div></td><td><div align=""right"">"& cRS("Ctproductprice") &"</div></td><td><div align=""right"">"& lineTotal & vbCrLf &"</div></td>"
HTML = HTML &"</tr>"

cRS.MoveNext
loop
0
Comment
Question by:Gigabandit
9 Comments
 
LVL 5

Accepted Solution

by:
drnick earned 64 total points
ID: 9647904
sometimes it might be usefull to do

crs.movelast
crs.movefirst

before any access to .eof or .recordcount.
this might look strange, but i collided once with the circumstance that .recordcount was 0 in my app when the recordset was opened, and so .eof was true, i think i remember, althought there were records in the set. with this sniplet i got it to work.
0
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9647989
Well since i dont have the rS at my place i substuted it with text. the asp code has no error. can you plese tell me what error you are facing?
0
 
LVL 8

Assisted Solution

by:SNilsson
SNilsson earned 62 total points
ID: 9648141

You can try:

Do until  cRS.EOF
   cRS("Ctproductprice").value
   cRS.MoveNext
Loop

If that work you ADO stuff is allright.

Change the string HTML to sHTML

And change " to '  like this
HTML = HTML &"<td><div align=""center"">"& cRS("Ctquantity") & "</div></td><td><div align=""center"">" & cRS("Ctsize")
to this:
sHTML = sHTML & "<td><div align='center'>" & cRS("Ctquantity").value & "</div></td><td><div align='center'>" & cRS("Ctsize").value

Also note that some places you have  (&") without spaces put in a space as needed  (& ").

If it still dont work you might have the name on one of your columns misspellt.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Assisted Solution

by:bhagyesht
bhagyesht earned 62 total points
ID: 9648165
besides this if the property value doesnt have a space you can ignore the quotes. quotes are needed when the property value has spaces.
one more thing is then you dont need div tag you can specify the alignment in the td tag
0
 
LVL 1

Assisted Solution

by:cassim
cassim earned 62 total points
ID: 9651487

pls check for NULL values in the result set. one of the fields must be returning a null value.
0
 
LVL 8

Expert Comment

by:SNilsson
ID: 9848949
This Question is getting old, can you please clean it up.

Regards SNilsson
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What is the compatible hibernate version for spring 4.3.1 10 77
bunnyEars challenge 6 102
Exe program is not a valid Win 32 application 15 106
wordcount challenge 11 108
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now