473,386 Members | 1,741 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,386 software developers and data experts.

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=VBScript %>
<% Option Explicit %>
<!--#include file="DatabaseConnect.asp"-->
<!--#include virtual="06winter/levini/database/adovbs.inc"-->
<html>
<head><title>Shopping Cart</title>
<link rel="stylesheet" href="BookStore.css" type="text/css">
</head>
<table>

<!-- Header SSI starts here-->
<!--#include file="header.html"-->
<!-- Header SSI ends here-->
<!-- Author SSI begins here-->
<!--#include file="ListAuthors.asp"-->
<!-- Author SSI ends here-->
<%
'This shopping cart uses a cookie named "ShoppingCart"
'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.QueryString("isbn"))
'sql statement for individual books
strSQL = "SELECT tblBookDescription.ISBN,
tblBookDescription.strTitle, tblBookDescription.strDescription,
tblBookDescription.strPublisher, tblBookDescription.dblPrice,
tblAuthors.AuthorID " & _
"FROM tblAuthors INNER JOIN (tblBookDescription INNER JOIN
tblAuthorsBooks ON tblBookDescription.ISBN = tblAuthorsBooks.ISBN) ON
tblAuthors.AuthorID = tblAuthorsBooks.AuthorID " & _
"WHERE (((tblBookDescription.ISBN)='" & ISBN & "')); "

response.write("strSQL = " & strSQL)
Set objRS = Server.CreateObject("ADODB.Recordset")

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.cookies("ShoppingCart")("ISBN"&iItemCount ) = ISBN
end if

'Delete items from Cart
If Request.QueryString("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"&iItem) = ISBN then
bFound = "True"
else
iItem = iItem + 1
End If
Loop

If bFound then
'replace the deleted item with the item above it
iItemCount=iItemCount - 1
For iCount = iItem to iItemCount
Response.Cookies("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.Cookies("ShoppingCart")("ItemCount")=iIte mCount
Response.Cookies("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><font 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="ProductPage.asp?isbn= <% =objRS("ISBN")%> ">
<% =objRS("strTitle")%></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,verdana,helvetica><B>List Price:
<font color=#990000><strike><% =dblPrice
%></strike></font><br>

<FONT face=arial,verdana,helvetica>Our Price:
<font color=#990000><% =curDiscPrice %></font><br>

<FONT face=arial,verdana,helvetica>You Save:
<font color=#990000><% =FormatCurrency((dblPrice -
curDiscPrice)) %>(20%)</b></font><br><br>
</td>
<td valign="top" width="62" >
<a
href="ShoppingCart.asp?ISBN=<%=objRS("ISBN")%>&act ion=del"> Remove</a>
</td>
</tr>

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

'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">Shipping*:</td>
<td width="75"><p align="right"><% =dblShipping
%></td>
</tr>
<tr>
<td width="75">Total:</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="#99CCFF">
<tr>
<td><a href="default.asp"><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 2305

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("dblPrice")*.8))
dblPrice = (objRS("dblPrice"))

'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,verdana,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,helvetica;
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
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...
2
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...
0
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 =...
1
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...
2
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...
2
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...
6
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
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...
4
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...
1
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.