I have written one store procedure which raise error on same specific condition. when i call this store procedure using vb.net code using sqlcommand I m not able to catch RAISEERROR
Store Procedure
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
exception is not raised when store procedure condition is matched.
Any help will be appreciated
Add a return statement after raiserror:
RAISERROR('Product Quantity should not be more than Required qty.',16,1);
RETURN;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.