关于存储过程如何捕捉返回值! ( 积分: 20 )

  • 主题发起人 主题发起人 13708782004
  • 开始时间 开始时间
1

13708782004

Unregistered / Unconfirmed
GUEST, unregistred user!
/*
加入一条基本信息
会计科目

-1 inttostr 失败
-2 有相关数据存在
-3 parid 不存在
-4 记录已存在或有相同的记录
-7 系统行,不能分类
*/
CREATE PROCEDURE F_B_InsertA
( @Parid varchar(25),
@dbname varchar(30),
@FullName varchar(66),
@Name varchar(30),
@UserCode varchar(26),
@Comment varchar(256),
@Total00 Numeric(24,8),
@namepy varchar(60),
@BakTemp1 int,
@BakTemp2 int,
@BakTemp3 int
)
AS
Declare @EtypeId_1 varchar(25)
Declare @nReturntype int
Declare @nSoncount int
Declare @nSonnum int
Declare @leveal int
Declare @ParRec int
Declare @checkValue int
-- 取得ID号

exec @nReturntype=F_B_createId @ParId,@dbname,@EtypeId_1 out,@nSonnum out,@nSoncount out, @ParRec out

if @nReturntype=-101 goto error111
if @nReturntype=-102 goto error112
if @nReturntype=-103 goto error113
if @nReturntype=-107 goto error117

Exec @checkValue=mzw_CheckBasicSet
if @checkValue=1 -- 查找编号和全名不能完全相同
begin
if exists(Select [typeid] From atype Where ([typeId]=@EtypeId_1 or ([fullname]=@fullname
and [usercode]=@usercode)) and [deleted]<>1) goto error114
end
if @checkValue=2--全名不能完全相同
begin
if exists(Select [typeid] From atype Where ([typeId]=@EtypeId_1 or ([fullname]=@fullname
)) and [deleted]<>1) goto error114
end
if @checkValue=3--编号不能完全相同
begin
if exists(Select [typeid] From atype Where ([typeId]=@EtypeId_1 or (
[usercode]=@usercode)) and [deleted]<>1) goto error114
end
goto succee
succee:
Return 0
error111:
Return -1
error112:
Return -2
error113:
Return -3
error114:
Return -4
error117:
Return -7
GO
--------------------------
请问各位,delphi前台如何如何调用并且捕捉返回值!
 
/*
加入一条基本信息
会计科目

-1 inttostr 失败
-2 有相关数据存在
-3 parid 不存在
-4 记录已存在或有相同的记录
-7 系统行,不能分类
*/
CREATE PROCEDURE F_B_InsertA
( @Parid varchar(25),
@dbname varchar(30),
@FullName varchar(66),
@Name varchar(30),
@UserCode varchar(26),
@Comment varchar(256),
@Total00 Numeric(24,8),
@namepy varchar(60),
@BakTemp1 int,
@BakTemp2 int,
@BakTemp3 int
)
AS
Declare @EtypeId_1 varchar(25)
Declare @nReturntype int
Declare @nSoncount int
Declare @nSonnum int
Declare @leveal int
Declare @ParRec int
Declare @checkValue int
-- 取得ID号

exec @nReturntype=F_B_createId @ParId,@dbname,@EtypeId_1 out,@nSonnum out,@nSoncount out, @ParRec out

if @nReturntype=-101 goto error111
if @nReturntype=-102 goto error112
if @nReturntype=-103 goto error113
if @nReturntype=-107 goto error117

Exec @checkValue=mzw_CheckBasicSet
if @checkValue=1 -- 查找编号和全名不能完全相同
begin
if exists(Select [typeid] From atype Where ([typeId]=@EtypeId_1 or ([fullname]=@fullname
and [usercode]=@usercode)) and [deleted]<>1) goto error114
end
if @checkValue=2--全名不能完全相同
begin
if exists(Select [typeid] From atype Where ([typeId]=@EtypeId_1 or ([fullname]=@fullname
)) and [deleted]<>1) goto error114
end
if @checkValue=3--编号不能完全相同
begin
if exists(Select [typeid] From atype Where ([typeId]=@EtypeId_1 or (
[usercode]=@usercode)) and [deleted]<>1) goto error114
end
goto succee
succee:
Return 0
error111:
Return -1
error112:
Return -2
error113:
Return -3
error114:
Return -4
error117:
Return -7
GO
--------------------------
请问各位,delphi前台如何如何调用并且捕捉返回值!
 
后退
顶部