Microsoft KB Archive/189948

= BUG: NextRecordset Fails on Remoted or Disconnected Records =

Article ID: 189948

Article Last Modified on 3/2/2005

-

APPLIES TO


 * Microsoft ActiveX Data Objects 1.5
 * Microsoft ActiveX Data Objects 2.0
 * Microsoft ActiveX Data Objects 2.1 Service Pack 2
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7
 * Microsoft Remote Data Services 1.5
 * Remote Data Service for ADO 2.0
 * Microsoft Remote Data Services 2.1
 * Remote Data Service for ADO 2.5
 * Remote Data Service for ADO 2.6
 * Microsoft Remote Data Services 2.0

-



This article was previously published under Q189948



SYMPTOMS
When you call the NextRecordset method on a remoted or disconnected recordset, one of the following error message appears:

Run-time error: '3251':

The operation requested by the application is not supported by the provider.

-or-

The object or provider is not capable of performing requested operation.



RESOLUTION
If you are using RDS there is no known workaround. Refer to the MORE INFORMATION section for information on command_click1. If you are using an ADO code, do not set the active connection to nothing (that is, do not disconnect the recordset). Refer to the MORE INFORMATION section for information on command_click2.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Start Visual Basic. Create a "Standard EXE" project. On the Project menu, choose References and add a reference to Microsoft ActiveX Data Objects Library. Add two Command buttons to the form.  Copy the following code into the form. The first Command button's code demonstrates the problem with RDS, and the second Command button's code demonstrates the problem with straight ADO. '''

NOTE''': Both examples use the sample tables provided in SQL Server's Pubs database. You must change and to the correct values before you run this code. Make sure that UID has the appropriate permissions to perform this operation on the database. Private Sub Command1_Click Dim ds As Object  'RDS.DataSpace. Dim df As Object  'RDSServer.DataFactory. Dim oRsCompound As adodb.Recordset  'Resultset. Dim iCount As Integer  ' Open compound recordset. Dim sCn As String Dim sSQL As String

sCn = "Provider=MSDASQL;dsn=localserver;uid= ;pwd= ;database=pubs" sSQL = "SELECT * FROM authors; " & _ "SELECT * FROM stores; " & _ "SELECT * FROM jobs"

Set ds = CreateObject("RDS.DataSpace") Set df = ds.CreateObject("RDSServer.DataFactory","http://localhost") Set oRsCompound = df.Query(sCn, sSQL)

Do Until oRsCompound Is Nothing Debug.Print "Contents of recordset #" & iCount Do While Not oRsCompound.EOF Debug.Print, oRsCompound.Fields(0), oRsCompound.Fields(1) oRsCompound.MoveNext Loop Set oRsCompound = oRsCompound.NextRecordset iCount = iCount + 1 Loop

End Sub

Private Sub Command2_Click

Dim oRsCompound As adodb.Recordset Dim iCount As Integer  ' Open compound recordset. Dim sCn As String Dim sSQL As String

sCn = "Provider=SQLOLEDB;" & _ "Data Source=servername;" & _ "Initial Catalog=pubs;" & _ "User Id= ;Password= ;"

sSQL = "SELECT * FROM authors; " & _ "SELECT * FROM stores; " & _ "SELECT * FROM jobs"

Set oRsCompound = New adodb.Recordset oRsCompound.CursorLocation = adUseClient oRsCompound.Open sSQL, _ sCn, _ adOpenUnspecified, _ adLockUnspecified

'If next line is commented out it works. Set oRsCompound.ActiveConnection = Nothing Do Until oRsCompound Is Nothing Debug.Print "Contents of recordset #" & iCount Do While Not oRsCompound.EOF Debug.Print, oRsCompound.Fields(0), _ oRsCompound.Fields(1) oRsCompound.MoveNext Loop Set oRsCompound = oRsCompound.NextRecordset iCount = iCount + 1 Loop End Sub </ol>

Keywords: kbbug kbnofix kbdatabase KB189948

-

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

© Microsoft Corporation. All rights reserved.