473,946 Members | 29,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Im Stuck. 0x800A0E7D

Oli
Hi

Here is the problem section of code.....

<%
else

intOrderID = cstr(Session("O rderID"))

set rsProd = Server.CreateOb ject("ADODB.Rec ordset")
rsProd.Open "SELECT * FROM itemsOrdered " _
& "WHERE OrderID="& intOrderID, _
Cn, adOpenDynamic, adLockPessimist ic, adCmdText
while not rsProd.EOF

element = "quant" & rsProd("product ID")
intQuant = Request.form(el ement)

if intQuant <> "" and isNumeric(intQu ant) then
if intQuant = 0 then
rsProd.Delete
else
rsProd("quantit y") = intQuant
end if
end if
rsProd.Update
rsProd.MoveNext
wend
............... .......

The error is ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed
or invalid in this context.
/basket.asp, line 109

Line 109 is set rsProd = Server.CreateOb ject("ADODB.Rec ordset")

---------------
Any help appreciated
THanks
Oli

Jul 19 '05 #1
2 3754
Oli wrote:
Hi

Here is the problem section of code.....

<%
else

intOrderID = cstr(Session("O rderID"))

set rsProd = Server.CreateOb ject("ADODB.Rec ordset")
rsProd.Open "SELECT * FROM itemsOrdered " _
& "WHERE OrderID="& intOrderID, _
Cn, adOpenDynamic, adLockPessimist ic, adCmdText
while not rsProd.EOF

element = "quant" & rsProd("product ID")
intQuant = Request.form(el ement)

if intQuant <> "" and isNumeric(intQu ant) then
if intQuant = 0 then
rsProd.Delete
else
rsProd("quantit y") = intQuant
end if
end if
rsProd.Update
rsProd.MoveNext
wend
............... ......

The error is ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either
closed or invalid in this context.
/basket.asp, line 109

Line 109 is set rsProd = Server.CreateOb ject("ADODB.Rec ordset")

I doubt that this is really line 109. This statement will never generate
that error. It must be one of the later lines.

Why are you opening such an expensive cursor (dynamic, pessimistic lock)?
You are limiting the ability of your application to handle many users.
Depending on what kind of database this is (always tell us the type and
version of your database: it's always relevant), and how many rows are in
this table, you coulc possibly be locking all other users completely out of
this table while this loop is occurring.

Also, I don't know how many columns your table has, but it seems very
wasteful to use selstar ("select * ") to pull them all down when you only
seem to need work with two of them, especially when you consider that using
selstar requires ADO to make two trips to your database instead of one.

Instead of looping through a recordset, you might want to consider looping
through your form variables instead, constructing the appropriate sql
statements (or better yet, passing the values to a stored procedure) to
accomplish the deletion or update. Something like this*:

dim sSQL, prodid
intOrderID = cstr(Session("O rderID"))
for each element in request.form
if left(element,5) = "quant" then
prodid = mid(element,6)
intQuant = Request.form(el ement)
if len(intQuant) > 0 then
if CInt(intQuant) = 0 then
sSQL = "DELETE FROM itemsOrdered " & _
"WHERE OrderID="& intOrderID & " AND " & _
"productID = " & prodid
else
sSQL = "UPDATE itemsOrdered " & _
"SET quantity = " & intQuant & _
" WHERE OrderID="& intOrderID & " AND " & _
"productID = " & prodid
end if
cn.Execute sSQL,,adCmdText
end if
end if
next
*I don't know the datatype of productID. I assumed above that it was
numeric. If it is actually character, change the above statements to:

"productID = '" & prodid & "'"

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
you first need to create the connection to the DB
set Conn = server.createob ject("adodb.con nection")
then connect
Conn.open "provider=SQLOL EDB.1;User id=<USERID>;Pas sword=<PASSWORD >;Initial
Catalog=<DBNAME >;Data Source=<SERVERN AME>"

then load the recordset
Set RS = Conn.execute ("Select * from <TABLE> where...")

loop recordset
Do while not RS.EOF
<code>
RS.MoveNext
loop
"Oli" <ol*@NOSPAMoliw oods.co.uk> wrote in message
news:c3******** **@sparta.btint ernet.com...
Hi

Here is the problem section of code.....

<%
else

intOrderID = cstr(Session("O rderID"))

set rsProd = Server.CreateOb ject("ADODB.Rec ordset")
rsProd.Open "SELECT * FROM itemsOrdered " _
& "WHERE OrderID="& intOrderID, _
Cn, adOpenDynamic, adLockPessimist ic, adCmdText
while not rsProd.EOF

element = "quant" & rsProd("product ID")
intQuant = Request.form(el ement)

if intQuant <> "" and isNumeric(intQu ant) then
if intQuant = 0 then
rsProd.Delete
else
rsProd("quantit y") = intQuant
end if
end if
rsProd.Update
rsProd.MoveNext
wend
............... ......

The error is ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/basket.asp, line 109

Line 109 is set rsProd = Server.CreateOb ject("ADODB.Rec ordset")

---------------
Any help appreciated
THanks
Oli


Jul 19 '05 #3

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

Similar topics

1
1729
by: No | last post by:
I purchased a program ( So I thought) that turned out to be just a bunch of php scripts put together. I am getting terrible support from the author but I am biting my tongue because I don't want to piss him off. My question to anyone who knows is, Am I stuck with him for support or can anyone qualified in php help me, in other words is it common for php authers to encrpt the scripts so others can't see what's in them?? If I can get...
2
10529
by: Tom Petersen | last post by:
I have been copying and pasting code and this has been working, but now I get this error: Error Type: ADODB.Recordset (0x800A0E7D) Operation is not allowed on an object referencing a closed or invalid connection. /forms/maintreqresults1.asp, line 26. I'm sure I'm missing something simple, but I am at a loss with this. The code is below, the URL string appears to be valid:
8
2279
by: middletree | last post by:
I had some text links at the top of all my pages (in one include file), which worked just fine. But I was asked to make it so that people in a certain department, (this is an Intranet app) would see a particular link that nobody else would. You'd find their name by getting their network logon. This worked fine on all my pages, but for some reason, on one page, it gives me an error. First, the error: Error Type: ADODB.Recordset...
8
2960
by: MLH | last post by:
I use a mouse-down procedure to trap right mouse clicks and CTRL-Right mouse clicks. Running the procedure must put honey or some other sticky substance into my keyboard because subsequent RightMouseClicks run as if they were CTRL-RightMouseClicks I have to close the form and reopen it to clear this behavior. Then, after the first CTRL-RightMouseClick, it starts all over again.
4
8785
by: Astronomically Confused | last post by:
using System; using System.Collections; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; class HttpProcessor { private Socket s;
4
3134
by: =?Utf-8?B?TWF1cg==?= | last post by:
My cd is stuck in the drive. I can open the drawer O K but the c d will not come out Help me please -- Maur
0
1860
by: =?Utf-8?B?QmlsbEI=?= | last post by:
This is a tough one... My Windows Service app periodically performs some processing on new entries to a SQL Server database table. It uses a simple System.Timer to call the Elapsed event handler (which contains the processing code) every minute. The processing itself usually takes no more than a few seconds. Even so, I have a boolean set in the event handler when I'm currently processing information so that only one thread is...
7
2873
by: alphasahoo | last post by:
Hi I am working on a program which writes the output a SQL select statements from number of source tables first to a load matrix and then writes to a load.dat file. But while writing to the load.dat file, the program gets stuck if I am putting float variables getting rounded to 8 or 9 decimal places. But runs fine if the float variable getting rounded to 6 decimal places. The code snippet is below:
1
3382
by: shivasusan | last post by:
Hi Friends! Please Help me! How i can solve this error? Please explain me, what is the error and how to solve? Error Type: ADODB.Recordset (0x800A0E7D) The connection cannot be used to perform this operation. It is either closed or invalid in this context. /H3finalresult/include/accept_reject2.asp, line 18
0
10162
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9981
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11566
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
11153
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
11338
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
10688
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6112
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
6331
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.