gpt4 book ai didi

OLEDB IMultipleResults->getResult 不返回行集

转载 作者:行者123 更新时间:2023-12-02 03:43:28 25 4
gpt4 key购买 nike

我在 sql server 数据库中有一个存储过程,它包含一个 select 语句,因此在调用存储过程时它应该作为结果集返回:

Create Procedure SqlTxFunctionTesting (
@inparam decimal(15,3),
@outparam decimal(15,3) output,
@inoutparam decimal(15,3) output)
AS
BEGIN
set @outparam = @inparam * 2;
set @inoutparam = @inoutparam * 4;
select * from resultsetdata;
return @inparam * 8;
END

我正在使用

执行存储过程
m_pICommandText->Execute(NULL, IID_IMultipleResults, 
&params, &nRowsAffected, (IUnknown **)&m_IMultipleResultSets)))

并尝试使用

获取结果集
HRESULT getResultSetRetCode = m_IMultipleResultSets->GetResult(NULL, 0, IID_IRowset, &
nRowsAffected, (IUnknown **)&m_pIRowset);

第一次调用返回 S_OK 且 m_pIRowset 为 NULL,第二次调用返回 DB_S_NORESULT。为什么它不返回 select 语句的结果集?在我开枪之前请帮忙。

最佳答案

不知道你有没有问过same question这里也是,但看起来非常相似:-

I discovered this while trying to create the standalone test program. I had created my stored procedure on the database that I thought was the default database for the user I was connecting as. The default database turned out to be set to something else, and that database also had a stored procedure with the same name, but without having any select statement (resultset). So I had wrongly thought that the stored procedure was executing select statement but it was not available to the OLEDB program.

所以简而言之,问题可能出在您自己身上!!! :)

关于OLEDB IMultipleResults->getResult 不返回行集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18792983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com