Microsoft Knowledge Base Email Alertz

(262681) - 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'...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 262681 - Last Review: June 28, 2004 - Revision: 3.1

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

This article was previously published under Q262681

On This Page

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.

MORE INFORMATION

Steps to Reproduce the Behavior

To reproduce the behavior, perform the following steps:
  1. Create an ASP page on IIS 5.0 with the following code:
    <%
       Dim oConn, oRs
    	
       Set oConn = Server.CreateObject("ADODB.Connection")
       Set oRs = Server.CreateObject("ADODB.Recordset") 
    		
       oConn.Open "Provider=SQLOLEDB.1;Data Source=<ServerName>;User Id=sa;Initial Catalog=Northwind"
    
       Set oRs.ActiveConnection = oConn
       oRs.CursorLocation = 3
    	
       oRs.Open "SELECT * FROM Employees"
       Set oRs.ActiveConnection = Nothing
       
       oConn.Close
       Set oConn = Nothing
    
       'Bug occurs if ADO Recordset is stored in Session 
    variable after opening
       Set Session("session_recordset") = oRs
    
       Do While Not oRs.EOF
          Response.Write oRs("LastName") & "<BR>"
          oRs.MoveNext 
       Loop
    
       oRs.Close
       Set oRs = Nothing     	
    	
    %>
    					
  2. 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.

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
249175  (http://kbalertz.com/Feedback.aspx?kbNumber=249175/EN-US/ ) FIX: Storing an ADO Recordset in GIT Might Cause An Access Violation
248287  (http://kbalertz.com/Feedback.aspx?kbNumber=248287/EN-US/ ) INFO: Understanding ADO Marshaling

APPLIES TO
  • Microsoft Active Server Pages 4.0
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft Internet Information Services 5.0
Keywords: 
kbado260fix kbbug kbfix kbmdac260fix KB262681
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate