BUG: Access Violation in Internet Explorer When You Use the RDS DataControl (306078)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01
  • Microsoft Internet Explorer (Programming) 4.01 SP1
  • Microsoft Internet Explorer (Programming) 4.01 SP2
  • Microsoft Internet Explorer (Programming) 5
  • Microsoft Internet Explorer (Programming) 5.01
  • Microsoft Internet Explorer (Programming) 5.01 SP1
  • Microsoft Internet Explorer (Programming) 5.5

This article was previously published under Q306078

SYMPTOMS

If you try to run the MoveNext method of a Remote Data Service (RDS) DataControl object's Recordset in client-side script (which exists in an HTML or Active Server Pages page), an access violation occurs in Internet Explorer. Users receive the following error message:
Unhandled exception in IEXPLORE.EXE (MSHTML.DLL): 0xC0000005: Access Violation.
This problem only occurs when the RDS DataControl object is bound to a server-side ActiveX Data Objects (ADO) Recordset object in client-side script.

CAUSE

This problem occurs because RDS is a client-side technology and is not designed to work with server-side ADO recordsets. It is not a recommended programming practice to bind an RDS DataControl to a server-side ADO Recordset object. This article is classified as a bug only because Internet Explorer generates an access violation and stops responding (crashes) when you run such code. Ideally, Internet Explorer should be able to trap and report the error without causing an access violation.

RESOLUTION

To work around this problem, open and bind a client-side ADO Recordset to the RDS DataControl. To do this, set the CursorLocation property of the ADO Recordset to adUseClient (ADO Constant value 3) before you open it.

STATUS

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

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new file named RdsTest.htm in Notepad, and paste the following code:
    <html>
    <head>
    </head>
    <body>
    <object id=RDS classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" style="display: none;">
    </object>
    
    <script language="VBScript">
    Dim RS
    
    sub Window_OnLoad()
            ConnStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
                      "Persist Security Info=False;Initial Catalog=pubs;Data Source=(local)"
            SQL = "SELECT * FROM authors"
            set RS = createobject("ADODB.Recordset")
            'RS.CursorLocation = 3 'Client-side Cursor 
            RS.Open SQL, ConnStr
            set RDS.SourceRecordset = RS
    end sub
    
    sub BindRS_Err()	
             RDS.Recordset.MoveNext
            MsgBox RDS.Recordset.Fields(0)
    end sub
    
    </script>
    <p><button onclick="BindRS_Err()" id=button3 name=button3>Move</button>
    </body>
    </html>
    					
  2. Modify the ADO connection string and SQL SELECT statement to point to a Microsoft Access or SQL Server database and table in your environment. In this sample, the ADO connection string is set to connect to the PUBS SQL Server sample database on the local computer.
  3. Save RdsTest.htm, and open it in Internet Explorer.
  4. Click Move to run the MoveNext method of the RDS DataControl object's Recordset. Notice that an access violation occurs.

    Workaround

  5. Close Internet Explorer, and open the RdsTest.htm in Notepad.
  6. Uncomment the RS.CursorLocation=3 statement in the Window_onLoad() procedure, and save the change.
  7. Open RdsTest.htm in Internet Explorer.
  8. When the page is displayed, click Move. Notice that you do not encounter an access violation. The value of the first field in the first record of the ADO Recordset that is generated when the SELECT statement executes is displayed in a message box in Internet Explorer.

Modification Type:MajorLast Reviewed:5/8/2003
Keywords:kbbug kbfix KB306078