_Commandptr CMD; cmd.createInstance ("AdoDb.command"); // ID number _ParameterPtr PParamrk; PParamrk.createInstance ("AdoDb.Parameter"); PParamrk-> Name = "job_id"; // Store parameter 1 PParamrk- > Type = adINteger; // Integer PPARAMRK-> SIZE = 2; // pParamrk-> Direction = Adparaminput; // Indicates input parameter cstring tstr; tstr.format ("% d", id); PParamrk-> Value = _variant_t (tstr); // int-> cstring -> _ variant_t assignment cmd-> parameters-> append (pParamrk); // return value _Parameterptr PParamok; PParamok.createInstance ("AdoDb.Parameter"); PParamok-> Name = "DESC"; // Parameter 2 Name PParamok-> type = adchamok-> type = adchar; // String PParamok-> size = 20; // Size is 20 bytes PParamok-> Direction = adpaamoutput; // Declaration is output parameter cmd -> parameters-> append (pParamok); // _ variant_t thevalue = MySet-> getCollect ("Field_1"); // cstring svalue = (char *) _ BSTR_T (Thevalue);
CMD-> ActiveConnection = Piconnection; cmd-> commandtext = "test"; // stored procedure name cmd-> commandType = adcmdstoredProc; // Indications as stored procedure adcmdStoredProc // execution, get results CMD-> Execute (null, null , adcmdstoredProc); // Return value to return (char *) _ BSTR_T (PParamok-> Value);