Solved

calling oracle stored procedues from VC++ using ADO

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ORA-01403: no data found 43 82
matchUp  challenge 6 48
Fibonacci challenge 11 82
mapAB Challlenge 35 85
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now