MSDataShape Error
-
SHAPE {EXEC sp_S_Events} APPEND ({SELECT * FROM attendees WHERE event_id=?} RELATE event_id TO PARAMETER 0) AS rsAttendees
From a method (namely, GetEvents) of my COM+ business layer component (written in Visual C++ 6.0 SP5), I am issuing the statement given above but it fails with an error saying: Error 0x80004005: The data provider or other service returned an E_FAIL status. However, the same statement works perfectly fine when executed from within a program of Visual Basic. A small portion of code from my COM+ component is given below:STDMETHODIMP CBizLayer::GetEvents(/*[in]*/ long EventID, /*[out, retval]*/ VARIANT *pDataset) {
_ConnectionPtr spConn;
_RecordsetPtr spDataset;
try {
.
. // instantiate an ado connection and an recordset object
.
spConn->Provider = L"MSDataShape";
spConn->Open(szConnect, _bstr_t(), _bstr_t(), -1);spDataset->PutRefActiveConnection(spConn);
spDataset->PutCursorLocation(adUseClient);
spRS->Open(szShapeCmd, vtMissing, adOpenForwardOnly, adLockReadOnly, adCmdText);
spRS->PutRefActiveConnection(NULL);::VariantClear(pDataset);
V_VT(pDataset) = VT_DISPATCH;
V_DISPATCH(pDataset) = (IDispatch*)(spDataset.Detach());m_spObjectContext->SetComplete();
_hr = S_OK;
}
catch(const _com_error &ex) {
[...]
}
catch(...) {
[...]
}I've tried to debug my component and I found out that the call to CBizLayer::GetEvents() method completes without any error (i.e. with an HRESULT of S_OK), but in the client application, I still receive this error :wtf: :wtf:. Why? What could be the reason? I am totally confused! Please help! Gurmeet
BTW, can Google help me search my lost pajamas?
My Articles: HTML Reader C++ Class Library, Numeric Edit Control