Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Can't read multi-field resultsets in ADO with C++

Can't read multi-field resultsets in ADO with C++

From: seekingsolns <seekingsolns_at_yahoo.com>
Date: 23 Oct 2001 12:54:15 -0700
Message-ID: <ab3e23fe.0110231154.26033f9b@posting.google.com>


I am trying to call an stored procedure from ADO that has several resultset outputs. My problem is trying to read from the second field of the output resultset. The "NextRecordset" method does not give me access as I would expect. I have seen many examples in VB but cannot find any C++ code examples.

The stored procedure looks like this:

    PROCEDURE multirec

        (onessn  IN    NUMBER,
         abc	OUT NUMBER,
         tableabc    OUT   tssn,
         tablessn    OUT   tssn,
         ssn     OUT   NUMBER)

    IS
    BEGIN
        ssn := 5 * onessn;
        tableabc(1) := 10 * onessn;
        tablessn(1) := 20 * onessn;
        abc := 2 * onessn;

    END; Using C++, I use the ADO command object and set up the execute command text. Question marks in the bsExecuteString denote scalar parameters:

    _bstr_t bsExecuteString = "{call mixparam.multirec(?,?,{resultset 100, tableabc},{resultset 100,tablessn},?)}";

    comm->put_ActiveConnection(_variant_t((IDispatch *)m_connection,true));

    comm->put_CommandText(bsExecuteString);     comm->put_CommandType(adCmdText);

I then append all the scalar parameters to the command object and execute the command object with the "open method" like this:

    RecSetPtr->Open(_variant_t((IDispatch *)comm,true),vtEmpty, adOpenStatic, adLockReadOnly, 0);

I can then read all the scalar output parameters but only the first field of the resultset. That is, I can only read the records in "tableabc" and not "tablessn":

    pFP = RecSetPtr->Fields->GetItem(& index);     vRes.bsName = pFP->GetName(); // Gives "tableabc"     vRes.cvValue = pFP->GetValue(); // Gives the correct value

How do I get to the second field of the resultset (ie "tablessn")??? The "NextRecordset" method just gives this error:

        Code = 800a0cb3
        Code meaning = Unknown error 0x800A0CB3
        Source = ADODB.Recordset
        Description = Object or provider is not capable of performing
requested operation.

Thanks in advance. Received on Tue Oct 23 2001 - 14:54:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US