存储过程代码如下
数据库为SQL2005
- SQL code
CREATE PROCEDURE [dbo].[sp_labinsertrcvmaster] @reqno varchar(20), @rtncode int OUTPUTASBEGIN IF EXISTS (SELECT tmd FROM Table_1 WHERE tmd = @reqno) BEGIN SET @rtncode = 2 RETURN 2 END INSERT INTO Table_1(tmd) VALUES (@reqno) IF @@ERROR <>0 BEGIN SET @rtncode = 0 RETURN 0 END SET @rtncode = 1 RETURN 1END
PB代码
- VB code
Int li_retString ls_als_a = 'gr'declare ccc procedure for sp_labinsertrcvmaster @reqno=:ls_a,@rtncode=0;execute ccc;if sqlca.sqlcode = -1 then rollback; messagebox('','')else fetch ccc into :li_ret;//这个代码执行 提示 “Cursor is not open”(是不是取存储过程返回值不是这样写的) commit;end ifclose ccc;
我想取这个存储过程得返回值
高手请教
在线等。。。。。
------解决方案--------------------
试没试加上 OUTPUT 呢?
DECLARE sp_duration PROCEDURE FOR pr_date_diff_prd_ken
@var_date_1 = :ad_start,
@var_date_2 = :ad_end,
@rtn_diff_prd = :ls_duration OUTPUT;