ALTER PROCEDURE sp_CheckCoInstrState --检查器具状态
@CoInstrId int --器具ID
AS
declare @TransId as int
declare @RecvId as int
declare @Msg as varchar(200)
if exists(SELECT * from b_CoInstr where CoInstrId=@CoInstrId and takeId<1) begin
SELECT @TransId=TransId from b_CoInstr where CoInstrId=@CoInstrId and takeId<1
SELECT @RecvId=RecvId from b_Trans where TransId=@TransId
set @Msg = '该器具确实没有进行取件登记!请检查委托单:'+Convert(varchar(9),@RecvId)+'!'
RAISERROR (@Msg, 16, 1)
return 0
end
else begin
Update CoInstr set StateId=0 where CoInstrId=@CoInstrId
return 1
end
上面这一句RAISERROR (@Msg, 16, 1)
在C# 中捕获就行了
发表于 @ 2007年09月06日 12:59:00 | 评论( loading... ) | 举报| 收藏