CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2000
    Location
    Dallas, Texas
    Posts
    62

    Question ADO and Oracle- Trouble executing stored procedures

    I'm using ADO against an Oracle 10g database.

    2 problems:
    1.) calling the following stored procedures throws an exception on the last line in the code below (DB_E_ERRORSINCOMMAND; IDispatch error #3092):
    Code:
    	ADODB::_CommandPtr pCommand;  // Stored Procs
    	ADODB::_RecordsetPtr recordSet;
    
    	pDBConn.CreateInstance( __uuidof( ADODB::Connection ) );
    	_bstr_t connectString = GetConnectString();
    	pDBConn->Open( connectString, "", "", 0);
    
    	pCommand.CreateInstance(__uuidof(ADODB::Command));
    	pCommand->ActiveConnection = pDBConn;
    	pCommand->CommandType = ADODB::adCmdStoredProc;
    	pCommand->CommandText = _bstr_t("sp_getcard");
    
    	VARIANT vCardNum;
    	vCardNum.vt = VT_BSTR;
    	vCardNum.bstrVal =  _bstr_t( "100" );
    
    
    pCommand->Parameters->Append(pCommand->CreateParameter(_bstr_t("CardNum"),ADODB::adVarChar,ADODB::adParamInput,50,vCardNum)); recordSet = pCommand->Execute( NULL, NULL,ADODB::adCmdStoredProc);
    This procedure compiles within Oracle; the examples I've seen on the web lead me to believe that my approach should work. Can anyone help or direct me any ADO + Oracle (not ADO.NET) sites that may shed light on this.

    Here's the actual Stored Proc:

    ( CardNum IN VARCHAR2, RC1 IN OUT Omwb_emulation.globalPkg.RCT1)AS BEGIN OPEN RC1 FOR SELECT LastName, FirstName, CardNumber, UserDate FROM Addresses WHERE CardNumber = CardNum; END sp_getcard;

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: ADO and Oracle- Trouble executing stored procedures

    [ moved thread ]
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Dec 2000
    Location
    Dallas, Texas
    Posts
    62

    Question Re: ADO and Oracle- Trouble executing stored procedures

    OK, let me ask this then:
    Has anyone every use ADO to retrieve data from an Oracle stored procedure?

  4. #4
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

  5. #5
    Join Date
    Dec 2000
    Location
    Dallas, Texas
    Posts
    62

    Unhappy Re: ADO and Oracle- Trouble executing stored procedures

    thanks. The second link didn't work when I downloaded and ran the sample. I'm looking @ the second one ( I'm a VC++ guy, not VB, so will have to parse this one out ). Maybe it's the PL/SQL that is the problem ( even though the stored proc compiles in Oracle ).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured