error C2065: ¡°adCmdProc¡± : non-declared identifier

  • Thread starter Thread starter Joseph Lu
  • Start date Start date
J

Joseph Lu

Hi all,
When I use the below line code to execute a stored procedure , I got a
error as described below:

My code line :
pMyConnect->Execute("EXEC sp_test"
,&RecordsAffected,adCmdProc);
Error :
error C2065: ¡°adCmdProc¡± : non-declared identifier

Could any body tell me why?

Thanks in advance!

Joseph
 
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();
}
 
Back
Top