[英]How can we handle MSSQL raiseerror in VB.net code behind using sqlcommand?
我編寫了一個存儲過程,在相同的特定條件下會引發錯誤。 當我使用sqlcommand使用vb.net代碼調用此存儲過程時,我無法捕獲RAISEERROR
存放程序
Create sp_UPDATE
as
begin
IF @QTY > @ReqAlloQty
BEGIN
RAISERROR('Product Quantity should not be more than Required qty.',16,1)
goto EXITWITHERROR
END
end
VB.NET
Try
m_commDBcommand.ExecuteNonQuery()
Catch ex As Exception
Finally
End Try
匹配存儲過程條件時,不會引發異常。
任何幫助將不勝感激
在rarrrror之后添加一個返回語句:
RAISERROR('Product Quantity should not be more than Required qty.',16,1);
RETURN;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.