Retrieving stored procedure output parameter via ADO

后端 未结 3 1403
有刺的猬
有刺的猬 2021-01-19 22:07

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         


        
3条回答
  •  再見小時候
    2021-01-19 23:05

    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
    

提交回复
热议问题