B
babyboom
Unregistered / Unconfirmed
GUEST, unregistred user!
我用delphi的ADOStoredProc连接sql server 2000的pubs数据库。调用自己写的存储过程。
总是报如下错误
ADOStoredProc1:CommandText does not return a result set.
好像跟返回值有关系。如果存储过程没有返回值就不报错。但是有返回值就报错。
存储过程如下,已通过测试:
---------------------------------------------
create procedure get_sales_for_title @title varchar(80)=NULL,@ytd_sales int output
as
if @title is null
begin
print 'error:You must specify a title value.'
return(1)
end
else
begin
if (select count(*) from titles where title=@title)=0
return(2)
end
select @ytd_sales =ytd_sales
from titles where title=@title
if @@error<>0
begin
return(3)
end
else
begin
if @ytd_sales is null
return(4)
else
return(0)
end
GO
总是报如下错误
ADOStoredProc1:CommandText does not return a result set.
好像跟返回值有关系。如果存储过程没有返回值就不报错。但是有返回值就报错。
存储过程如下,已通过测试:
---------------------------------------------
create procedure get_sales_for_title @title varchar(80)=NULL,@ytd_sales int output
as
if @title is null
begin
print 'error:You must specify a title value.'
return(1)
end
else
begin
if (select count(*) from titles where title=@title)=0
return(2)
end
select @ytd_sales =ytd_sales
from titles where title=@title
if @@error<>0
begin
return(3)
end
else
begin
if @ytd_sales is null
return(4)
else
return(0)
end
GO