Solved

calling oracle stored procedues from VC++ using ADO

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 32
has77  challenge 9 85
wait notify demo infinite loop 3 110
abstract class with all non abstract mentods 6 76
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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

772 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