Microsoft KB Archive/268972

= PRB: Requery of ADODB.Recordset Returns Unknown Error Message (80040e4b) with Microsoft Remote Provider =

Article ID: 268972

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Data Access Components 1.5
 * Microsoft Data Access Components 2.0
 * Microsoft Data Access Components 2.1
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6
 * Microsoft Plus! Game Pack: Cards & Puzzles
 * Remote Data Service for ADO 2.0
 * Microsoft Remote Data Services 2.1
 * Remote Data Service for ADO 2.5

-



This article was previously published under Q268972



SYMPTOMS
When you use the Microsoft Remote provider to run a parameterized query against a remote database, the Requery method of the ADODB.Recordset object fails with the following error message:

Unknown Error (80040e4b).



RESOLUTION
To work around this problem delete and then re-create any parameters for the parameterized query before you issue the Requery method.



Steps to Reproduce Behavior
 Create a new Visual Basic project. From the Projects menu, click References, and then add a reference to Microsoft ActiveX Data Objects.  Paste the following code into the module for Form1: Private conn As ADODB.Connection Private rs As ADODB.Recordset Private cmd As ADODB.Command

Private Sub Form_Load

Dim strConn As String strConn = &quot;Provider=MS Remote;Remote Server=http://MyServer;DSN=Northwind;&quot;

Set conn = New ADODB.Connection conn.CursorLocation = adUseClient conn.Open strConn Set cmd = New ADODB.Command Set cmd.ActiveConnection = conn cmd.CommandText = &quot;Select CategoryName, Description From Categories Where CategoryID=?&quot; cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamInput,, 1) Set rs = cmd.Execute MsgBox rs(&quot;CategoryName&quot;) ' If the following two lines are uncommented, the Requery works.

' cmd.Parameters.Delete 0 ' cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamInput,, 1)

rs.Requery  ' >>> error message &quot;Unknown error&quot; (80040e4b) rs.Close Set rs = Nothing Set conn = Nothing End Sub  If necessary, modify the connection string and query. Run the project. The error message described in the &quot;Symptoms&quot; section occurs.

Additional query words: parameter requery MS Remote 80040e4b

Keywords: kbcodesnippet kbprb KB268972

-

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

© Microsoft Corporation. All rights reserved.