M
middletree
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.ServerVariables("LOGON_USER"),"domainname\","")
Set RSLogon = Server.CreateObject("ADODB.Recordset")
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.execute strSQL,,&h00000080
strDepartmentID = RSLogon("DepartmentID")
strEmployeeID = RSLogon("EmployeeID")
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.
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.ServerVariables("LOGON_USER"),"domainname\","")
Set RSLogon = Server.CreateObject("ADODB.Recordset")
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.execute strSQL,,&h00000080
strDepartmentID = RSLogon("DepartmentID")
strEmployeeID = RSLogon("EmployeeID")
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.