Microsoft KB Archive/262681

= FIX: When You Store an ActiveX Data Objects Recordset Object Session in Internet Information Server 5.0 =

Article ID: 262681

Article Last Modified on 6/28/2004

-

APPLIES TO


 * Microsoft Active Server Pages 4.0
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q262681



SYMPTOMS
When an ActiveX Data Objects (ADO) recordset is stored in a session variable that is in an Active Server Pages (ASP) application, you may get one of the following error messages:

Microsoft VBScript runtime (0x800A01FB)

An exception occurred: 'Session'

-or-

Active Server Pages, ASP 0241 (0x80004005)

The CreateObject of '(null)' caused exception C0000005.

-or-

Microsoft VBScript runtime (0x800A01FB)

An exception occurred: 'Open'



CAUSE
This problem occurs because the session variables in Internet Information Server (IIS) 5.0 are stored in the Global Interface Table (GIT), and this causes an access violation with an open recordset when it is stored in a session variable.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Microsoft Data Access Components version 2.6 or later.



Steps to Reproduce the Behavior
To reproduce the behavior, perform the following steps:   Create an ASP page on IIS 5.0 with the following code: <%  Dim oConn, oRs Set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;) Set oRs = Server.CreateObject(&quot;ADODB.Recordset&quot;) oConn.Open &quot;Provider=SQLOLEDB.1;Data Source=;User Id=sa;Initial Catalog=Northwind&quot;

Set oRs.ActiveConnection = oConn oRs.CursorLocation = 3 oRs.Open &quot;SELECT * FROM Employees&quot; Set oRs.ActiveConnection = Nothing oConn.Close Set oConn = Nothing

'Bug occurs if ADO Recordset is stored in Session variable after opening Set Session(&quot;session_recordset&quot;) = oRs

Do While Not oRs.EOF Response.Write oRs(&quot;LastName&quot;) & &quot;&quot; oRs.MoveNext Loop

oRs.Close Set oRs = Nothing %>                    Browse the ASP page you created, and then refresh the ASP page. One of the error messages is displayed after you refresh the ASP page.

