All my code as listed as below:
_ConnectionPtr pMyConnect=NULL;
HRESULT hr=pMyConnect.CreateInstance(__uuidof(Connection));
if(FAILED(hr))return;
_bstr_t strConnect="Provider=SQLOLEDB; Server=127.0.0.1;Database=webtest;
uid=sa; pwd=;";
//connecting to the database server now:
try{
pMyConnect->Open(strConnect,"","",adModeShareDenyNone);
_variant_t RecordsAffected;
pMyConnect->Execute("EXEC sp_test" ,&RecordsAffected,2);
}
catch (_com_error &e)
{
AfxMessageBox(e.Description(), MB_OK ©¦ MB_ICONWARNING);
if(pMyConnect->State())
pMyConnect->Close();
}
> Hi all,
> When I use the below line code to execute a stored procedure , I got a
[quoted text clipped - 11 lines]
>
> Joseph
Joseph Lu - 20 Jul 2006 02:49 GMT
Well , I got it ,it should be adCmdStoredProc, not adCmdProc:-)
> All my code as listed as below:
>
[quoted text clipped - 33 lines]
>>
>> Joseph