Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How do I execute Oracle stored procedures from ADO in Visual C++?

How do I execute Oracle stored procedures from ADO in Visual C++?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestionoracle
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hojo
    wrote on last edited by
    #1

    I am trying to execute some stored procedures that have parameters but I keep getting errors. Simple stored procedures with no parameters I have no problem with. Here is my sample test code which keeps triggering user exceptions: strProcedure = "Hojo_Test_Fun"; strQuote = strProcedure; pCmd->CommandType = adCmdStoredProc; pCmd->CommandText = _bstr_t(strQuote); pCmd->Parameters->Append ( pCmd->CreateParameter ( _bstr_t("some_name"), adChar, adParamInput, 30, _variant_t(_bstr_t("ALKFO")) ) ); pBs = pCmd->Execute(&vNull,&vNull,adCmdUnknown); What am I doing wrong? Help! X| Hojo

    M N 2 Replies Last reply
    0
    • H Hojo

      I am trying to execute some stored procedures that have parameters but I keep getting errors. Simple stored procedures with no parameters I have no problem with. Here is my sample test code which keeps triggering user exceptions: strProcedure = "Hojo_Test_Fun"; strQuote = strProcedure; pCmd->CommandType = adCmdStoredProc; pCmd->CommandText = _bstr_t(strQuote); pCmd->Parameters->Append ( pCmd->CreateParameter ( _bstr_t("some_name"), adChar, adParamInput, 30, _variant_t(_bstr_t("ALKFO")) ) ); pBs = pCmd->Execute(&vNull,&vNull,adCmdUnknown); What am I doing wrong? Help! X| Hojo

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      I tend to leave the first parameter of CreateParameter as "" rather than passing some data in. What is the error message you are getting and where is it occuring. It might be useful if you could post the stored procedure too. Below is the kind of code I use. I have a set of wrapper classes that I use, so this code isn't exactly what I use but covers everything I call and how I call it.

      hr = m_pCommand->put_CommandText(_bstr_t("cti.CALLTRACK_ADD"));

      m_pCommand->CommandType = adCmdStoredProc;

      _ParameterPtr pParam;

      variant_t vtCallID("CAllIDData");

      pParam = m_pCommand->CreateParameter("", adChar, adParamInput, 64, vtCallID);

      m_pCommand->Parameters->Append(pParam);

      pParam->Value = vtCallID;

      m_pCommand->Execute(NULL, NULL, adCmdStoredProc);

      Michael :-)

      1 Reply Last reply
      0
      • H Hojo

        I am trying to execute some stored procedures that have parameters but I keep getting errors. Simple stored procedures with no parameters I have no problem with. Here is my sample test code which keeps triggering user exceptions: strProcedure = "Hojo_Test_Fun"; strQuote = strProcedure; pCmd->CommandType = adCmdStoredProc; pCmd->CommandText = _bstr_t(strQuote); pCmd->Parameters->Append ( pCmd->CreateParameter ( _bstr_t("some_name"), adChar, adParamInput, 30, _variant_t(_bstr_t("ALKFO")) ) ); pBs = pCmd->Execute(&vNull,&vNull,adCmdUnknown); What am I doing wrong? Help! X| Hojo

        N Offline
        N Offline
        NormDroid
        wrote on last edited by
        #3

        Send me your mail me direct and I'll send you a wrapper class and example. Norm Almond Chief Technical Architect FS Walker Hughes Limited

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups