Solved

calling oracle stored procedues from VC++ using ADO

Posted on 2001-09-15
5
614 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
  • 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 111
sum67 challenge 35 107
matchUp  challenge 6 68
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 336
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

790 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