Microsoft KB Archive/306078

= BUG: Access Violation in Internet Explorer When You Use the RDS DataControl =

Article ID: 306078

Article Last Modified on 5/8/2003

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer (Programming) 5.01 SP1
 * Microsoft Internet Explorer 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.



Steps to Reproduce Behavior
  Create a new file named RdsTest.htm in Notepad, and paste the following code: 

 Dim RS

sub Window_OnLoad ConnStr = &quot;Provider=SQLOLEDB.1;Integrated Security=SSPI;&quot; & _ &quot;Persist Security Info=False;Initial Catalog=pubs;Data Source=(local)&quot; SQL = &quot;SELECT * FROM authors&quot; set RS = createobject(&quot;ADODB.Recordset&quot;) '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

Move  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. Save RdsTest.htm, and open it in Internet Explorer.  Click Move to run the MoveNext method of the RDS DataControl object's Recordset. Notice that an access violation occurs.

Workaround
</li> Close Internet Explorer, and open the RdsTest.htm in Notepad.</li> Uncomment the RS.CursorLocation=3 statement in the Window_onLoad procedure, and save the change.</li> Open RdsTest.htm in Internet Explorer.</li> 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.</li></ol>

Additional query words: 0xC0000005 AV

Keywords: kbbug kbfix KB306078

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.