C++ 为什么是c++;无法从这样的存储过程中读取记录集
我需要从sql server存储过程中读取一些记录集。程序看起来很简单,但在阅读过程中,有些东西我不明白 存储过程版本1:C++ 为什么是c++;无法从这样的存储过程中读取记录集,c++,sql-server,C++,Sql Server,我需要从sql server存储过程中读取一些记录集。程序看起来很简单,但在阅读过程中,有些东西我不明白 存储过程版本1: ALTER PROCEDURE [dbo].[sp_cbqueue_pickup_some] as create table #tmp ( id bigint ) insert #tmp (id) select top 100 id from cbqueue where scheduletime<=GETDATE() and [FetchTime]
ALTER PROCEDURE [dbo].[sp_cbqueue_pickup_some]
as
create table #tmp
(
id bigint
)
insert #tmp (id)
select top 100 id
from cbqueue
where scheduletime<=GETDATE() and [FetchTime] is null
update CBQueue set fetchtime = GETDATE()
where ID in (select id from #tmp)
select languagesrc,countrysrc,operatorsrc
from cbqueue
where id in (select id from #tmp)
在这种情况下,当代码步执行此语句时:
while(!(pRecordset->EndOfFile))
程序将跳转到catch块
但如果我将存储过程更改为此表单:
ALTER PROCEDURE [dbo].[sp_cbqueue_pickup_some]
as
select languagesrc,countrysrc,operatorsrc from cbqueue
<> > C++代码不会再次发生异常,我花了很多时间来找到这个改变可以删除异常,但我还是不知道是什么原因。
有人能猜出我是谁吗什么例外?如果你的C++代码和你的存储过程在单独运行时工作,那就意味着问题不在那里,我会集中精力在你连接到SQL Server的库或驱动程序上,看我这个库在理解你的SQLL方面有一些问题,异常是“不能读内存”。您不应该在您的过程前面加上sp_3;。它具有特殊含义,适用于系统程序
ALTER PROCEDURE [dbo].[sp_cbqueue_pickup_some]
as
select languagesrc,countrysrc,operatorsrc from cbqueue