473,737 Members | 8,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error '80020009' help

hi i am creating a basic asp site that uses cookies to manage a cart
for an online store. whenever i open this page without adding anything
to the cart. i get an error message.

here is my code

<%@ Language=VBScri pt %>
<% Option Explicit %>
<!--#include file="DatabaseC onnect.asp"-->
<!--#include virtual="06wint er/levini/database/adovbs.inc"-->
<html>
<head><title>Sh opping Cart</title>
<link rel="stylesheet " href="BookStore .css" type="text/css">
</head>
<table>

<!-- Header SSI starts here-->
<!--#include file="header.ht ml"-->
<!-- Header SSI ends here-->
<!-- Author SSI begins here-->
<!--#include file="ListAutho rs.asp"-->
<!-- Author SSI ends here-->
<%
'This shopping cart uses a cookie named "ShoppingCa rt"
'to store the ISBNs of the items in the cart.
'The cookie puts each ISBN value into a separate key named ISBN1,
ISBN2, etc.
'The current number of items in the cart is stored in a key named
"ItemCount"

dim ISBN, iItemCount, iItem, iCount, bFound, curPrice, curDiscPrice,
strSQL, objRS, strTitle, dblPrice, dblShipping, dblSubTotal,
dblTotalPrice

ISBN = trim(Request.Qu eryString("isbn "))
'sql statement for individual books
strSQL = "SELECT tblBookDescript ion.ISBN,
tblBookDescript ion.strTitle, tblBookDescript ion.strDescript ion,
tblBookDescript ion.strPublishe r, tblBookDescript ion.dblPrice,
tblAuthors.Auth orID " & _
"FROM tblAuthors INNER JOIN (tblBookDescrip tion INNER JOIN
tblAuthorsBooks ON tblBookDescript ion.ISBN = tblAuthorsBooks .ISBN) ON
tblAuthors.Auth orID = tblAuthorsBooks .AuthorID " & _
"WHERE (((tblBookDescr iption.ISBN)='" & ISBN & "')); "

response.write( "strSQL = " & strSQL)
Set objRS = Server.CreateOb ject("ADODB.Rec ordset")

objRS.open strSQL, objConn
'Initialize iItemCount with number of books in the cart
If request.cookies ("ShoppingCart" ).HasKeys then
iItemCount = request.cookies ("ShoppingCart" )("ItemCount" )
else
'No cookie yet
iItemCount = 0
end if

'Add items to cart
If Request("action ") = "add" and len(ISBN)>5 then
'add new item to ShoppingCart
iItemCount = iItemCount + 1
Response.cookie s("ShoppingCart ")("ISBN"&iItem Count) = ISBN
end if

'Delete items from Cart
If Request.QuerySt ring("action") = "del" and len(ISBN)>5 then
'find the isbn
bFound = "False"
iItem = 1
Do while NOT bFound and iItem <= iItemCount
If Request.Cookies ("ShoppingCart" )("ISBN"&iIte m) = ISBN then
bFound = "True"
else
iItem = iItem + 1
End If
Loop

If bFound then
'replace the deleted item with the item above it
iItemCount=iIte mCount - 1
For iCount = iItem to iItemCount
Response.Cookie s("ShoppingCart ")("ISBN" &iCount)= _
Request.Cookies ("ShoppingCart" )("ISBN"&iCount +1)
Next
else
Response.write "Error: Could not match ISBN to delete."
end if
End If

'Update iItemCount
Response.Cookie s("ShoppingCart ")("ItemCount") =iItemCount
Response.Cookie s("ShoppingCart ").Expires = Date + 30

'
*************** *************** *************** *************** *************** ********
' You do not need to modify anything above this line.
' You will need to modify the table below to list the items
' in your cart, calculate, total costs, etc.
'
*************** *************** *************** *************** *************** ********

' list items in shopping cart
If iItemCount < 1 then
response.write "<center><f ont face='Comic Sans MS'
color='#FF0000' >" & _
"Your Shopping Cart is empty.</font><br><br>"
Else
%>
<div align="center">
<center>
<font face='Comic Sans MS' color='#FF0000' >You have <%
=iItemCount %>
book<% If iItemCount > 1 then response.write "s"%> in
your shopping cart.
</font><br><br>

<table border="0" cellpadding="5" cellspacing="0"
width="643">
<tr>
<td width="20" > &nbsp; </td>
<td width="256" ><font face="Comic Sans MS"
Book</font></td> <td align="center" width="66" ><font face="Comic Sans MS"Quantity</font></td> <td width="179" ><font face="Comic Sans MS"Price</font></td> <td width="62" ><font face="Comic Sans MS"Remove</font></td>

</tr>
<%
'List each item in cart
For iCount = 1 to iItemCount
ISBN =
Request.Cookies ("ShoppingCart" )("ISBN"&iCount )
%>

<tr>
<td valign="top" width="20" >1.</td>
<td valign="top" width="256">
<! Book Title, author, stock >
<a href="ProductPa ge.asp?isbn= <% =objRS("ISBN")% > ">
<% =objRS("strTitl e")%></a>
<br>
<font size="-1">
by <% =funListAuthors (objRS("ISBN")) %></a>
</font>
<br>
</td>
<td valign="top" align="center" width="66">1</td>
<td valign="top" width="179">
<! Price >
<FONT face=arial,verd ana,helvetica>< B>List Price:
<font color=#990000>< strike><% =dblPrice
%></strike></font><br>

<FONT face=arial,verd ana,helvetica>O ur Price:
<font color=#990000>< % =curDiscPrice %></font><br>

<FONT face=arial,verd ana,helvetica>Y ou Save:
<font color=#990000>< % =FormatCurrency ((dblPrice -
curDiscPrice)) %>(20%)</b></font><br><br>
</td>
<td valign="top" width="62" >
<a
href="ShoppingC art.asp?ISBN=<% =objRS("ISBN")% >&action=del" > Remove</a>
</td>
</tr>

<% Next
%> </table>
</center>
<%End If
%>
<tr>
<td></td><td></td><td></td>
<td>
<FONT face=arial,verd ana,helvetica>
<table border="0" cellpadding="0" cellspacing="0"
width="150" >
<tr>
<% dim i
-----------------------------------------------------error here
curPrice = FormatCurrency( objRS("dblPrice "))
curDiscPrice = FormatCurrency( (objRS("dblPric e")*.8))
dblPrice = (objRS("dblPric e"))

'response.write (iItemCount)
dblSubTotal = 0
for i = 1 to iItemCount
dblSubTotal = dblSubTotal + curDiscPrice
next

dblShipping = 3.49 + ((iItemCount - 1) * .99)

dblTotalPrice = dblShipping + dblSubTotal

if iItemCount = 0 then
response.write( "<br>")
else
%>
<td width="75">Sub-Total:</td>
<td width="75"><p align="right">< %
=dblSubTotal%></td>
</tr>

<tr>
<td width="75">Ship ping*:</td>
<td width="75"><p align="right">< % =dblShipping
%></td>
</tr>
<tr>
<td width="75">Tota l:</td>
<td width="75"><p align="right">< %
=dblTotalPrice% ></td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>

<% end if%>

</table>
<br>
<div align="center">
<center>
<table border="0" cellpadding="5" cellspacing="0" width="400"
bgcolor="#99CCF F">
<tr>
<td><a href="default.a sp"><img border="0"
src="/06Winter/levini/images/continue-shopping.gif" width="121"
height="19"></a><br>
</td>
<td>
<p align="right">< a href="checkout. asp"><img border="0"
src="/06Winter/levini/images/proceed-to-checkout.gif" width="183"
height="31"></a>
</td>
</tr>
</table>

<table border="0" cellpadding="5" cellspacing="0" width="400">
<tr>
<td> <br><p align=center> Shipping is $3.49 for the first book
and $.99 for each additional book. To assure reliable delivery and
to keep your costs low we send all books via UPS ground.
</td>
</tr>
</table>
</body>
</html>
any help would be much appreciated thank you

Feb 27 '06 #1
2 2319

isaac2004 wrote:
hi i am creating a basic asp site that uses cookies to manage a cart
for an online store. whenever i open this page without adding anything
to the cart. i get an error message.
<% dim i
-----------------------------------------------------error here
curPrice = FormatCurrency( objRS("dblPrice "))
curDiscPrice = FormatCurrency( (objRS("dblPric e")*.8))
dblPrice = (objRS("dblPric e"))

'response.write (iItemCount)
dblSubTotal = 0
for i = 1 to iItemCount
dblSubTotal = dblSubTotal + curDiscPrice
next


That's because you are trying to do something with a record that
doesn't exist. You need to partition this part of the code off so
that it only runs if you have something in the cart.

Pseudo code...

If something in the cart then
do some stuff with the records
End if

/P.

Feb 27 '06 #2

isaac2004 wrote:
hi i am creating a basic asp site that uses cookies to manage a cart
for an online store. whenever i open this page without adding anything
to the cart. i get an error message.

here is my code

Some more advice for you to help with development/debugging:

1. Remove ALL tables and presentational markup from your page until
you know that the ASP code is working properly.

2. Don't include adovbs.inc unless you use it. So far you've only used
default cursors, so it's not needed in the examples you've given.

3. Test the values of your variables thoughout the code using
response.write var & "<br>". That way you'll know whether the code is
working correctly.

4. When you do put the presentational html in, make use of the css file
you've included.

This sort of thing:
<FONT face=arial,verd ana,helvetica>< B>List Price:
<font color=#990000>< strike><% =dblPrice %></strike></font>


is terrible. It should be put in the css file:

..strike {
text-decoration: line-through;
font family: arial,verdana,h elvetica;
font-weight: bold;
}

Then you use it like so: <span class="strike"> <% =dblPrice %></span>.
This will greatly reduce the amount of html code in your page and make
it much easier to tell what's what.

5. Check your html. Currently, you have no <body> tag in your document
at all. You have opened a table in another table, without putting the
second table in a td. Some browsers may display this as you intend,
but some others may not display it at all. You also have some divs
that overlap and unclosed tags.

HTH

/P.

Feb 27 '06 #3

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

Similar topics

0
3622
by: olivier Micheli | last post by:
Hello, I need help When I execute the following asp, I have the error message: ------------------------------- ADODB.Field error '80020009' BOF ou EOF est égal à True ou l'enregistrement actuel a été supprimé.
2
1706
by: Stoney | last post by:
Hello All I have an application I am working on that uses "compiled" asp pages. Once the asp pages are done, they are moved into a VB6 dll to be Response.Written from there. This work great, and results in keeping our code safe at client sites. Currently this works great here and at most client sites. I have one client who is having intermittent problems with this setup The code in my asp looks like this.. <%@ LANGUAGE="VBSCRIPT" %><...
0
1749
by: M Naeem Baig | last post by:
I have the following asp code running well on win 2000 (sp4 installed). But the same code on windows 2003 is giving error '80020009'. Dim Conn, strRS, RS, strConn Set Conn = Server.CreateObject("ADODB.Connection") Set RS = Server.CreateObject("ADODB.Recordset") Conn.Provider = "ADsDSOObject"
1
4069
by: Chris | last post by:
I get the follow error on a linux box that is running sun asp: CDONTS.NewMail.1 error '80020009' unable to connect to server The error occurs when the Send Command is Executed. Here is my code Dim objCDO 'CDO object ' Send it to ...
2
6305
by: dmiller23462 | last post by:
Hey guys, I'm back again....I've got the results displaying that I wanted but instead of having a "next" or "previous" link displayed I am getting the error msg below (I actually get the data that I'm supposed to get meaning that my query seems to be working fine but instead of making its way to the INCLUDE file (bottom navigation bar) it displays the following error msg instead of the included nav bar... *** error '80020009' Exception...
2
6110
by: SayMyName | last post by:
Due to my browser being danishm the error message will not mean much t most of you. It is an "Unspecified problem" with "Provide (0x80004005)" POST Data: error '80020009' The error only arrives with some apperently random files bein uploaded. Please Help
6
3081
by: Séverine Donnay | last post by:
Hello, I try to use the replace function with a very long text and I have this error : error '80020009' Exception occurred. Do you have any idee to resolve this problem ? Thanks
1
16456
by: Redeye | last post by:
Hello, I have created an ASP page that calls a local webservice. Everything works fine on my system but once it is deployed to the server I get the following error. WSDLReader error '80020009' WSDLReader:XML Parser failed at linenumber 0, lineposition 0, reason is: WINHTTP5.DLL or higher must be registered to use the ServerXMLHTTP object.
4
10909
by: peashoe | last post by:
I get the following error: ADODB.Field error '80020009' Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. This is my code: ' Get if module is hand-approved or not. query = "select *, m.Title as ModuleTitle, d.IsRanged, c.IsHandApproved as Approval, c.ApprovalDate as ApprovalDate, ci.InstructorID as UID, i.Email, i.FirstName, i.LastName" _ & " from ModuleTop m" _
1
7983
by: HotKgon | last post by:
When I try and run a code, I get: Run-time Error '-2147352567 (80020009)': The data has been changed. My code is: Dim rsSF12 As DAO.Recordset Dim SF12Score As Double
0
9470
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9258
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8207
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3278
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.