I have a store procedure which has multiple select statement or returns multiple record set.
I am using ADO C++ code to get result.
however I am getting only first record using _RecordsetPtr.
how I can get next record set ?
C# ADO .Net has method NextResult to get next record but I am unable to find equivalent in C++ ADO one.
sample C++ code
_bstr_t strCnn("Provider='sqloledb'; Data Source=server; Initial Catalog='pubs';
Integrated Security='SSPI';");
string cmd = "TestProc";
// Define ADO object pointers, initialize pointers. These are in the ADODB::
namespace.
_CommandPtr pCmd = NULL;
_ConnectionPtr pConnection = NULL;
_RecordsetPtr rec = NULL;
try
{
TESTHR(pConnection.CreateInstance(__uuidof(Connection)));
TESTHR(pCmd.CreateInstance(__uuidof(Command)));
TESTHR(rec.CreateInstance(__uuidof(Recordset)));
pConnection->Open(strCnn, "", "", adConnectUnspecified);
pCmd->PutRefActiveConnection(pConnection)
pCmd->CommandText = cmd.c_str();
rec = pCmd->Execute(NULL, NULL, adCmdStoredProc); //store proc returns multiple record set
while (true)
{
if (rec->EndOfFile == -1)
{
break;
}
rec->MoveNext(); //getting only first record here
}
//Need to get next here
pConnection->Close();
}
catch (_com_error& e)
{
PrintComError(e);
}