Solved

calling oracle stored procedues from VC++ using ADO

Posted on 2001-09-15
5
616 Views
Last Modified: 2013-11-20
Hello,
I am using VC++ 6.o and trying to call oracle stored procedures with ADO.
I have attached the below code which is executed after establishing a connection with the database using a ODBC driver.
this code throws an exception when i am trying to retrieve the record set.
also can u suggest some sites/books anything else for my reference.
the procedure "spproc" is as below:
/**********************
create procedure spproc
num number;
begin
select bay_no into num from bay_dtl where rownum =1;
end;
/*****************
the bay no is an integer in the bay_dtl table.
/*********code*********
try    
     {
          _CommandPtr pCommand;
          _ParameterPtr pParam1;

          HRESULT hr = pCommand.CreateInstance (__uuidof (Command));

          if (FAILED (hr))
          {
               AfxMessageBox ("Can't create an instance of Command");
               return;
          }
         
          pCommand->ActiveConnection = m_pConn;
          pCommand->CommandText = "spproc";
          pCommand->CommandType = adCmdStoredProc;
          _RecordsetPtr pRecordset;
          hr = pRecordset.CreateInstance (__uuidof (Recordset));
          if (FAILED (hr))
          {
               AfxMessageBox ("Can't create an instance of Recordset");
               return;
          }

          pRecordset = pCommand->Execute(NULL,NULL,adCmdStoredProc);
          CString strContent;
/* throws an exception here
          strContent = (char *) (_bstr_t) pRecordset->Fields->GetItem ("bay_no")->Value;

 
               AfxMessageBox(strContent);
          }
thanks in advance
0
Comment
Question by:seemad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 1

Expert Comment

by:MRNMurthy
ID: 6484586
Hi,

I will try & getback to u with update.

From

MRN Murthy
0
 
LVL 6

Accepted Solution

by:
Triskelion earned 200 total points
ID: 6484609
http://govt.oracle.com/~tkyte/ResultSets/index.html

What version of ORACLE?
It looks as if you'll need ORACLE 8 or higher.
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6484612
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9532356
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: Triskelion

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question