Microsoft KB Archive/253674

From BetaArchive Wiki

Article ID: 253674

Article Last Modified on 8/23/2001


  • 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 Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition

This article was previously published under Q253674


When creating an ADO recordset using an Oracle Decode statement that returns null values, ADO generates the following error message:

Run-Time error 'Data Provider or other Service Returned an E_Fail Status.'

NOTE: This error does not occur when you use the Oracle 8.1.6 client.


Change the CursorLocation to adUseServer.


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


Steps to Reproduce Behavior

  1. Start Visual Basic and create a Standard Exe project. Create a reference to Microsoft ActiveX Data Objects 2.1 or later.
  2. Place the following code into Form1.

    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Private Sub Form_Load()
        'Comment out the line below to make it work.
        cn.CursorLocation = adUseClient
        cn.Open "Provider=MSDAORA;Data Source=YourOraclealias;User ID=YourUserID;Password=YourPassword"
        rs.Open "select decode(employee_id,'7394','matches','') from employee", cn, adOpenKeyset, adLockOptimistic
        Debug.Print rs(0)
    End Sub
  3. Change the ConnectionString to use a valid Data Source.
  4. Run the project.Result: The above mentioned run-time error.

  5. Comment this line of code: cn.CursorLocation = adUseClient
  6. Run the project again.Result: No errors. The recordset contains nulls but is valid.


Keywords: kboracle kbprb KB253674