PRB: RDS May Return E_FAIL Status When Querying Index Server

Exclusion de responsabilité du contenu obsolète de la base de connaissances

Cet article a été rédigé sur les produits pour lesquels Microsoft n’offre plus aucune prise en charge. Par conséquent, cet article est proposé « en l’état » et ne sera plus mis à jour.


Using the Data Factory in Remote Data Service 2.x to query Index Server for the document titles (DocTitle field) generates one of the following errors:
The data provider or other service returned an E_FAIL status.
Error: -2147217887 (80040e21) Description: Multiple-step operation generated errors. Check each status value. Source: Microsoft Cursor Engine
-or when using MDAC 2.6 or 2.7-
Run-time error '-2147267259 (80004005)':

Stream object cannot be read because it is empty, or the current position is at the end of the stream. For non-empty streams, set the current position with the Position property. To determine if a stream is empty, check the Size property.
The same errors will result for any of the Doc* properties or user-defined properties.


Index Server does not hard-code the datatype for DocTitle as a string. Thus the return value is recognized as a VARIANT. Remote Data Service is known to fail when handling the DBTYPE_VARIANT datatype for a property retrieved in OLE DB. Returning such a type with Remote Data Service results in the E_FAIL status error.


You can resolve this problem in the following ways:
  • Remove DocTitle from the Index Server query.
  • Use ActiveX Data Objects (ADO) to query for the DocTitle.

More Information

Steps to Reproduce Behavior

  1. Start a new Visual Basic project.
  2. Reference Remote Data Service and ADO libraries.
  3. Add two command buttons to Form1.
  4. Copy and paste the following code over any declarations and code already present in the Form1 code module. Edit the server name ("HTTPServer") as appropriate.
    Option Explicit
    Dim rs As ADODB.Recordset
    Dim strSQL As String
    Const HTTPServer As String = "myServer"
    Const Scope As String = "C:\"
    Const QueryText As String = "Index Server"

    Private Sub Command1_Click()

    Dim DS As RDS.DataSpace
    Dim DF As Object

    Set DS = New RDS.DataSpace
    Set DF = DS.CreateObject("RDSServer.DataFactory", "http://" & HTTPServer)
    Set rs = DF.Query("Provider=msidxs", strSQL)

    Do Until rs.EOF
    Debug.Print rs("Filename"), rs("Vpath"), rs("DocTitle")

    Set rs = Nothing

    End Sub

    Private Sub Command2_Click()

    Dim cn As ADODB.Connection
    Set cn = New ADODB.Connection
    cn.Open "Provider=MSIDXS" ';Server=http://" & HTTPServer

    Set rs = cn.Execute(strSQL)
    Do Until rs.EOF
    Debug.Print rs("Filename"), rs("Vpath"), rs("DocTitle")

    Set rs = Nothing
    Set cn = Nothing

    End Sub

    Private Sub Form_Load()

    strSQL = "SELECT Filename, Vpath, DocTitle FROM Scope('" + Chr(34) + _
    Scope + Chr(34) + "') WHERE CONTAINS('" + Chr(34) + QueryText + _
    Chr(34) + "') > 0 ORDER BY Rank DESC"
    Debug.Print strSQL

    End Sub
  5. Use Command1 to reproduce the error message described above. Use Command2 to execute the query successfully using ADO.

ID d'article : 241794 - Dernière mise à jour : 30 sept. 2003 - Révision : 1