Microsoft Knowledge Base Email Alertz

(240205) - When you use ActiveX Data Objects (ADO), you can call the Parameters.Refresh method for a parameterized SELECT statement. When you are using the Microsoft OLE DB Provider for Oracle (MSDAORA), this may return the following error: The Provider cannot...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 240205 - Last Review: September 30, 2003 - Revision: 2.0

PRB: ADO Parameters.Refresh Fails with MSDAORA Provider and Parameterized Query

This article was previously published under Q240205

On This Page

SYMPTOMS

When you use ActiveX Data Objects (ADO), you can call the Parameters.Refresh method for a parameterized SELECT statement. When you are using the Microsoft OLE DB Provider for Oracle (MSDAORA), this may return the following error:
The Provider cannot derive parameter info and SetParameterInfo has not been called.
The HRESULT error code is DB_E_PARAMUNAVAILABLE (0x80040e51).

CAUSE

The Microsoft OLE DB Provider for Oracle does not derive parameter information.

RESOLUTION

If you need this functionality, use the OLE DB Provider for ODBC and the Microsoft Oracle ODBC driver.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Microsoft Visual Basic 6.0, create a new project.
  2. Add a reference to the ADO library.
  3. Add two buttons to run the two routines provided below. One routine calls to the OLE DB Provider for Oracle, and the other calls to the ODBC driver by way of the ODBC OLE DB Provider. The OLE DB routine returns the error shown in the "Symptoms" section, and the ODBC routine works correctly.
    Private Sub cmdUseOLEDB_Click()
        Dim cnDatabase As ADODB.Connection
        Dim qryParameterized As ADODB.Command
        Dim strConn As String
        Dim strSQL As String
        
        strConn = "Provider=MSDAORA;Data Source=myOracleSrv;" & _
                  "User ID=demo;Password=demo;"
        strSQL = "SELECT * FROM Customer WHERE CUSTID = ?"
        
        Set cnDatabase = New ADODB.Connection
        cnDatabase.Open strConn
        
        Set qryParameterized = New ADODB.Command
        Set qryParameterized.ActiveConnection = cnDatabase
        qryParameterized.CommandText = strSQL
        qryParameterized.CommandType = adCmdText
        qryParameterized.Parameters.Refresh
        MsgBox qryParameterized.Parameters.Count
        Set qryParameterized = Nothing
        cnDatabase.Close
        Set cnDatabase = Nothing
    End Sub
    
    Private Sub cmdUseODBC_Click()
        Dim cnDatabase As ADODB.Connection
        Dim qryParameterized As ADODB.Command
        Dim strConn As String
        Dim strSQL As String
        
        strConn = "Provider=MSDASQL;Driver={Microsoft ODBC for Oracle};" & _
                  "Server=myOracleSrv;UID=demo;PWD=demo;"
        strSQL = "SELECT * FROM Customer WHERE CUSTID = ?"
        
        Set cnDatabase = New ADODB.Connection
        cnDatabase.Open strConn
        
        Set qryParameterized = New ADODB.Command
        Set qryParameterized.ActiveConnection = cnDatabase
        qryParameterized.CommandText = strSQL
        qryParameterized.CommandType = adCmdText
        qryParameterized.Parameters.Refresh
        MsgBox qryParameterized.Parameters.Count
        Set qryParameterized = Nothing
        cnDatabase.Close
        Set cnDatabase = Nothing
    End Sub
    					
  4. Substitute your Oracle server database alias for the one that is used in the sample (Server=myOracleSrv and Data Source = myOracleSrv).

APPLIES TO
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0
Keywords: 
kbdatabase kboracle kbprb kbprovider KB240205
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate