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

Im Stuck. 0x800A0E7D

Oli
Hi

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

<%
else

intOrderID = cstr(Session("OrderID"))

set rsProd = Server.CreateObject("ADODB.Recordset")
rsProd.Open "SELECT * FROM itemsOrdered " _
& "WHERE OrderID="& intOrderID, _
Cn, adOpenDynamic, adLockPessimistic, adCmdText
while not rsProd.EOF

element = "quant" & rsProd("productID")
intQuant = Request.form(element)

if intQuant <> "" and isNumeric(intQuant) then
if intQuant = 0 then
rsProd.Delete
else
rsProd("quantity") = 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.CreateObject("ADODB.Recordset")

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

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

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

<%
else

intOrderID = cstr(Session("OrderID"))

set rsProd = Server.CreateObject("ADODB.Recordset")
rsProd.Open "SELECT * FROM itemsOrdered " _
& "WHERE OrderID="& intOrderID, _
Cn, adOpenDynamic, adLockPessimistic, adCmdText
while not rsProd.EOF

element = "quant" & rsProd("productID")
intQuant = Request.form(element)

if intQuant <> "" and isNumeric(intQuant) then
if intQuant = 0 then
rsProd.Delete
else
rsProd("quantity") = 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.CreateObject("ADODB.Recordset")

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("OrderID"))
for each element in request.form
if left(element,5) = "quant" then
prodid = mid(element,6)
intQuant = Request.form(element)
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.createobject("adodb.connection")
then connect
Conn.open "provider=SQLOLEDB.1;User id=<USERID>;Password=<PASSWORD>;Initial
Catalog=<DBNAME>;Data Source=<SERVERNAME>"

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*@NOSPAMoliwoods.co.uk> wrote in message
news:c3**********@sparta.btinternet.com...
Hi

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

<%
else

intOrderID = cstr(Session("OrderID"))

set rsProd = Server.CreateObject("ADODB.Recordset")
rsProd.Open "SELECT * FROM itemsOrdered " _
& "WHERE OrderID="& intOrderID, _
Cn, adOpenDynamic, adLockPessimistic, adCmdText
while not rsProd.EOF

element = "quant" & rsProd("productID")
intQuant = Request.form(element)

if intQuant <> "" and isNumeric(intQuant) then
if intQuant = 0 then
rsProd.Delete
else
rsProd("quantity") = 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.CreateObject("ADODB.Recordset")

---------------
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
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...
2
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...
8
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...
8
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...
4
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
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
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...
7
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...
1
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...
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:
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
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?
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
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...

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.