473,834 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

0x800A0E7D error--don't get it

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 (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed
or invalid in this context.
/includes/header.inc, line 32

Before we go any farther, please note that I went to ASPFAQ.com, and
couldn't find an answer there which fit my situation. The article that
seemed to have the best shot for me was
http://www.aspfaq.com/show.asp?id=2191, but no dice.

Anyway, here's my code:

'this first line is there because when you get the network logon name, it is
prefixed by the domain name and a backslash. Since the db I am pulling data
from has only the logon name, I had to get rid of the first part:

strLogon= Replace(Request .ServerVariable s("LOGON_USER") ,"domainname\", "")
Set RSLogon = Server.CreateOb ject("ADODB.Rec ordset")
strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon& "'"
'this next line is the infamous line 32
RSLogon.Open strSQL, objConnection
objConnection.e xecute strSQL,,&h00000 080

strDepartmentID = RSLogon("Depart mentID")
strEmployeeID = RSLogon("Employ eeID")
RSLogon.Close
Set RSLogon = Nothing

If strDepartmentID = "9" then%>
do some stuff
End if

Keep in mind that this code works fine on other pages, just not this one. In
fact, it works when you first bring this page up, but it does submit to
itself, and when it does, you should see a "thank-you"-type message, but get
the error instead. But in the code at the top of the page, before it decides
if it's the original page or the repost, I have the same includes which
establish the same db connection. I mention this because the first thing
you look for is the difference between the pages that work and the ones that
don't. In fact, this code is in an include file which is used on all pages,
and that rules out any differences in code, you'd think.

Jul 19 '05 #1
8 2275
First, you do not seem to be opening a database connection.
Second, you seem to be executing the query twice.
Third, you are not checking to see if the query returns anything before
attempting to access column data.
Fourth, you should not explicitly create a recordset for that type of query.
Try:

strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon& "'"
Set RSLogon = objConnection.e xecute(strSQL,, 1)
If Not RSLogon.EOF Then
strDepartmentID = RSLogon("Depart mentID")
strEmployeeID = RSLogon("Employ eeID")
End If
RSLogon.Close
Set RSLogon = Nothing
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"middletree " <mi********@hto mail.com> wrote in message
news:uh******** ******@tk2msftn gp13.phx.gbl...
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 (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/includes/header.inc, line 32

Before we go any farther, please note that I went to ASPFAQ.com, and
couldn't find an answer there which fit my situation. The article that
seemed to have the best shot for me was
http://www.aspfaq.com/show.asp?id=2191, but no dice.

Anyway, here's my code:

'this first line is there because when you get the network logon name, it is prefixed by the domain name and a backslash. Since the db I am pulling data from has only the logon name, I had to get rid of the first part:

strLogon= Replace(Request .ServerVariable s("LOGON_USER") ,"domainname\", "") Set RSLogon = Server.CreateOb ject("ADODB.Rec ordset")
strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon& "'"
'this next line is the infamous line 32
RSLogon.Open strSQL, objConnection
objConnection.e xecute strSQL,,&h00000 080

strDepartmentID = RSLogon("Depart mentID")
strEmployeeID = RSLogon("Employ eeID")
RSLogon.Close
Set RSLogon = Nothing

If strDepartmentID = "9" then%>
do some stuff
End if

Keep in mind that this code works fine on other pages, just not this one. In fact, it works when you first bring this page up, but it does submit to
itself, and when it does, you should see a "thank-you"-type message, but get the error instead. But in the code at the top of the page, before it decides if it's the original page or the repost, I have the same includes which
establish the same db connection. I mention this because the first thing
you look for is the difference between the pages that work and the ones that don't. In fact, this code is in an include file which is used on all pages, and that rules out any differences in code, you'd think.

Jul 19 '05 #2
OK, I'll try it out. Thanks.

I am not sure why I shouldn't use a recordset, though.

I'm also not sure why this works on every other page which uses this same
exact code.
"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:ep******** *****@tk2msftng p13.phx.gbl...
First, you do not seem to be opening a database connection.
Second, you seem to be executing the query twice.
Third, you are not checking to see if the query returns anything before
attempting to access column data.
Fourth, you should not explicitly create a recordset for that type of query. Try:

strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon& "'"
Set RSLogon = objConnection.e xecute(strSQL,, 1)
If Not RSLogon.EOF Then
strDepartmentID = RSLogon("Depart mentID")
strEmployeeID = RSLogon("Employ eeID")
End If
RSLogon.Close
Set RSLogon = Nothing
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"middletree " <mi********@hto mail.com> wrote in message
news:uh******** ******@tk2msftn gp13.phx.gbl...
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 (0x800A0E7D)
The connection cannot be used to perform this operation. It is either

closed
or invalid in this context.
/includes/header.inc, line 32

Before we go any farther, please note that I went to ASPFAQ.com, and
couldn't find an answer there which fit my situation. The article that
seemed to have the best shot for me was
http://www.aspfaq.com/show.asp?id=2191, but no dice.

Anyway, here's my code:

'this first line is there because when you get the network logon name, it is
prefixed by the domain name and a backslash. Since the db I am pulling data
from has only the logon name, I had to get rid of the first part:

strLogon=

Replace(Request .ServerVariable s("LOGON_USER") ,"domainname\", "")
Set RSLogon = Server.CreateOb ject("ADODB.Rec ordset")
strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon& "'"
'this next line is the infamous line 32
RSLogon.Open strSQL, objConnection
objConnection.e xecute strSQL,,&h00000 080

strDepartmentID = RSLogon("Depart mentID")
strEmployeeID = RSLogon("Employ eeID")
RSLogon.Close
Set RSLogon = Nothing

If strDepartmentID = "9" then%>
do some stuff
End if

Keep in mind that this code works fine on other pages, just not this
one. In
fact, it works when you first bring this page up, but it does submit to
itself, and when it does, you should see a "thank-you"-type message, but

get
the error instead. But in the code at the top of the page, before it

decides
if it's the original page or the repost, I have the same includes which
establish the same db connection. I mention this because the first

thing you look for is the difference between the pages that work and the ones

that
don't. In fact, this code is in an include file which is used on all

pages,
and that rules out any differences in code, you'd think.


Jul 19 '05 #3
Mark Schupp wrote:
First, you do not seem to be opening a database connection.
Right, I'm not sure of this as well. Middletree, have you simply not shown
us the code where you opened the objConnection object?
Second, you seem to be executing the query twice.
That is true. Middletree, was one of these staements supposed to be
commented out?
RSLogon.Open strSQL, objConnection
objConnection.e xecute strSQL,,&h00000 080

The second statement is simply not correct. It should not be there. That is
the statement that should be used to execute a non-records-returning query.
Actually, I prefer to explicitly set the Options argument in the Open
statement (it's got nothing to do with your problem)

RSLogon.Open strSQL, objConnection,, ,1 '1 = adCmdText
Third, you are not checking to see if the query returns anything
before attempting to access column data.
Right. Always check the recordset's EOF property before attempting to access
any of its data.
Fourth, you should not explicitly create a recordset for that type of
query. Try:


Why not? What possible difference can that make? Whether you explicitly
create a recordset and then call its Open method, or use Execute to tell ADO
to create a recordset and open it should make absolutely no difference. I
hate when this advice is given because:
1. It's a waste of time - it's never the root of the problem
2. It confuses newcomers who think you are telling them not to use a
recordset - we're here to help people, not to further confuse them.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #4
middletree wrote:
OK, I'll try it out. Thanks.

I am not sure why I shouldn't use a recordset, though.

To Mark: See? He thought you were telling him not to use a recordset!

middletree, just to clarify: you are always using a recordset, even when you
use Execute (unless you use that &h00000080 constant (adExecuteNoRec ords) to
tell ADO not to create a recordset).

FWIW, I have never seen a problem solved by switching from

Set rs=server.creat eobject("adodb. recordset")
rs.open ...

to

set rs = conn.execute(.. .)

I have seen cases where problems were masked by the switch, but the root
problem was never addressed because the switch made everything "work".

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #5
Bob:

As always, thanks for you help. I have comments below:

"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:OY******** ******@TK2MSFTN GP12.phx.gbl...
Mark Schupp wrote:
First, you do not seem to be opening a database connection.
Right, I'm not sure of this as well. Middletree, have you simply not shown
us the code where you opened the objConnection object?


Well, I have an include file for every page which establishes the
connection. But that's on the pages where this works, and the one where it
doesn't.
Anyway, here's that code:
Dim strDBConnection
strDBConnection = _
"Provider=SQLOL EDB;" & _
"Persist Security Info=False;" & _
"Data Source=xxxxxx;" & _
"User ID=xxxxx;" & _
"Password=xxxxx ;" & _
"Database=xxxxx x;"

Dim objConnection
Set objConnection = Server.CreateOb ject("ADODB.Con nection")
objConnection.O pen strDBConnection
Second, you seem to be executing the query twice.
That is true. Middletree, was one of these statements supposed to be
commented out?
RSLogon.Open strSQL, objConnection
objConnection.e xecute strSQL,,&h00000 080


What happened there was I tried a million things before being so exhausted
by the whole thing that I posted a question.
Here's the code which is currently in use, and which works on all pages
except the one. Note that the Recordset is simply called RS, not RSLogon,
as the use of a rs name that was used elsewhere was one of many things I
thought might be a conflict.
(I replaced our network domain name with x's)

strLogon= Replace(Request .ServerVariable s("LOGON_USER") ,"xxxxx\","" )

Set RS = Server.CreateOb ject("ADODB.Rec ordset")
strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon& "'"
RS.Open strSQL, objConnection

strDepartmentID = rs("DepartmentI D")
strEmployeeID = rs("EmployeeID" )
rs.Close
Set rs = Nothing

If strDepartmentID = "9" then%>
<img src="images/spacer.gif" width="22" border="0">
<a href="DisplaySo rtableTickets.a sp?selectTSE=<% =strEmployeeID% >">
<span class="cellsmal l">Your open Tickets</span></a>
<%Else
end if
The second statement is simply not correct. It should not be there. That is the statement that should be used to execute a non-records-returning query. Actually, I prefer to explicitly set the Options argument in the Open
statement (it's got nothing to do with your problem)

RSLogon.Open strSQL, objConnection,, ,1 '1 = adCmdText
Third, you are not checking to see if the query returns anything
before attempting to access column data.
Right. Always check the recordset's EOF property before attempting to

access any of its data.


Noted. thanks.
Jul 19 '05 #6
> > Fourth, you should not explicitly create a recordset for that type of
query. Try:
Why not? What possible difference can that make? Whether you explicitly
create a recordset and then call its Open method, or use Execute to tell

ADO to create a recordset and open it should make absolutely no difference. I
hate when this advice is given because:
1. It's a waste of time - it's never the root of the problem
2. It confuses newcomers who think you are telling them not to use a
recordset - we're here to help people, not to further confuse them.
2 lines of code = 2 chances to mess up
1 line of code = 1 chance.

I probably would not have bothered with that bit of advice except that he
use both rs.open and conn.execute on the same SQL statement which indicates
a bit of confusion about recordset usage anyway. My guess as to his actual
problem is that he is not getting any records back. Since he was not
checking for EOF this would cause an error.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:OY******** ******@TK2MSFTN GP12.phx.gbl... Mark Schupp wrote:
First, you do not seem to be opening a database connection.
Right, I'm not sure of this as well. Middletree, have you simply not shown
us the code where you opened the objConnection object?
Second, you seem to be executing the query twice.


That is true. Middletree, was one of these staements supposed to be
commented out?
RSLogon.Open strSQL, objConnection
objConnection.e xecute strSQL,,&h00000 080

The second statement is simply not correct. It should not be there. That

is the statement that should be used to execute a non-records-returning query. Actually, I prefer to explicitly set the Options argument in the Open
statement (it's got nothing to do with your problem)

RSLogon.Open strSQL, objConnection,, ,1 '1 = adCmdText
Third, you are not checking to see if the query returns anything
before attempting to access column data.
Right. Always check the recordset's EOF property before attempting to

access any of its data.
Fourth, you should not explicitly create a recordset for that type of
query. Try:
Why not? What possible difference can that make? Whether you explicitly
create a recordset and then call its Open method, or use Execute to tell

ADO to create a recordset and open it should make absolutely no difference. I
hate when this advice is given because:
1. It's a waste of time - it's never the root of the problem
2. It confuses newcomers who think you are telling them not to use a
recordset - we're here to help people, not to further confuse them.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 19 '05 #7
"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:e3******** ******@TK2MSFTN GP12.phx.gbl...

I probably would not have bothered with that bit of advice except that he
use both rs.open and conn.execute on the same SQL statement which indicates a bit of confusion about recordset usage anyway. My guess as to his actual
problem is that he is not getting any records back. Since he was not
checking for EOF this would cause an error.

You are correct when you say that I am confused about recordsets. For some
reason, in 4 years of doing ASP (although not 40 hours per week), I have not
gotten connection strings, recordsets, anything related to that sort of
thing. Not sure why. I'm not dumb. 2 college degrees, won the spelling bee
in 5th grade, etc.

But it (lack of understanding about rs's and connections) usually doesn't
pose a problem, as I have code I can re-use. But I cannot emphasize enough
that what you saw of my code was the last in a chain of trying a million
different things. I can assure you that most of the day, I wasn't trying to
connect twice.
Jul 19 '05 #8
Well, I put in Mark's code below, and still got an "Object Required" error.
Only on that one page. Not sure why. But since the line it pointed to was
the objConnection.e xecute, I simply pasted in this code from the db
connection include file that I have at the top of all pages:

Set objConnection = Server.CreateOb ject("ADODB.Con nection")
objConnection.O pen strDBConnection
I have no idea why this works, but it does. Doesn't seem to affect any
other pages negatively, so I'm thankful for that. But it shouldn't have been
a problem on this one page, as the include file is here on this page, as
well, so objConnection should be there. I have no idea why this fixed it,
but am not up for spending any more time on this, as I have other fish to
fry.

thanks for your help, guys!

James W
www.middletree.net
"Mark Schupp" <ms*****@ielear ning.com> wrote in message
news:ep******** *****@tk2msftng p13.phx.gbl...
First, you do not seem to be opening a database connection.
Second, you seem to be executing the query twice.
Third, you are not checking to see if the query returns anything before
attempting to access column data.
Fourth, you should not explicitly create a recordset for that type of query. Try:

strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon& "'"
Set RSLogon = objConnection.e xecute(strSQL,, 1)
If Not RSLogon.EOF Then
strDepartmentID = RSLogon("Depart mentID")
strEmployeeID = RSLogon("Employ eeID")
End If
RSLogon.Close
Set RSLogon = Nothing
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com

Jul 19 '05 #9

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

Similar topics

2
10513
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:
2
3751
by: Oli | last post by:
Hi Here is the problem section of code..... <% else intOrderID = cstr(Session("OrderID")) set rsProd = Server.CreateObject("ADODB.Recordset")
0
2268
by: umshamma | last post by:
I am creating an asp programm for our employee leaves tracking... i am getting this error ADODB.Recordset (0x800A0E7D) The connection cannot be used to perform this operation. It is either closed or invalid in this context. /leave/add_to_leave.asp, line 16 here is the code: <% 'Dimension variables
3
2080
by: nordwall | last post by:
Hi! I am starting out with ASP and have tried the following code, to no avail as I get a error: ADODB.Recordset.1 (0x800A0E7D) Invalid connection. /save.asp, line 12 <% uuid = Request("uuid")
5
1583
by: liv | last post by:
<%@LANGUAGE="VBSCRIPT" %> <% dim id_utilizator, conn, rs id_utilizator = Session("id_utilizator") if id_utilizator ="" then Response.Redirect("logare_ut.asp") end if set conn=Server.CreateObject("ADODB.Connection")
3
5697
by: pooja1982 | last post by:
Hi, I m getting this message after executing the following code <% CALL OPENDATACON DIM RS SET RS=SERVER.CreateObject ("ADODB.RECORDSET") s="select * from dbpassenger order by ref_no" CALL OPENRS(RS,S) DIM RS1 dim aa
7
10558
by: STUPIDFORUM | last post by:
ADODB.Recordset "The connection cannot be used to perform this operation." "Microsoft Access Driver" ERROR 0X800A0E7D OLE exception from "ADODB.Recordset": The connection cannot be used to perform this operation. It is either closed or invalid in this context. Win32::OLE(0.1707) error 0x800a0e7d in METHOD/PROPERTYGET "Open" !stupid registrations! !STUPID FORUMS! STUPID MICROSOFT !NOTHING WORKING!
2
2979
by: colesslow | last post by:
i have these asp files to edit a record in my sql server..but it can't be done. the error is Error Type: ADODB.Recordset (0x800A0E7D) The connection cannot be used to perform this operation. It is either closed or invalid in this context. /testing/update22.asp, line 18 Can anyone help me??im stuck..thanks in advance here's the code for update.asp
1
3376
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
9796
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
10782
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
10500
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
10543
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
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4422
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
3972
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3078
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.