I\'m stuck with this for more than 48 Hrs now. I\'m trying to retrieve a output parameter value using ADO objects. here is my vba code.
Function ExecuteComm
Have a try after removing SET NOCOUNT ON;
from your procedure
I think this will help you. The affected row count will not returned if you set SET NOCOUNT ON;
in procedure.
If you are not expecting a recordset as part of your stored procedure call, use cmd1->Execute(NULL, NULL, ADO::adExecuteNoRecords);
This is probably because, as Technet says, In the case of output parameters and return values, the values are not returned until the data of the Recordset object has been fetched completely or the Recordset has been closed.
Either close your RecordSet (rds.Close
), if you're not interested in the data returned by the SELECT statement, or loop through it until you've read all rows.
As an aside, if you are never interested in the data returned by the select statement, only the row count, then it's more efficient not to return it. So if you can modify your SP, you could change it to:
SELECT @returnval = COUNT(*) FROM type_table WHERE type1=@para1 and type2=@para2 and type3=@para3