0

Hi,

I have a VB.Net system that connect to SQL Server through ODBC.
When I try to raiseerror from an IF...ELSE statement, it does not triggered the exception handling.

I have done some raise error testing at my side. Below is my finding:

1. RaiseError did not triggered exception:

CREATE PROC xxx
       AS
         IF 1=1
           BEGIN
             raiserror (70000,15,15)
           END

2. RaiseError triggered exception:

CREATE PROC xxx
       AS
         IF 1=1
           BEGIN
             raiserror (70000,15,15)
             raiserror (70000,15,15)
           END


       CREATE PROC xxx
       AS
       BEGIN
         raiserror (70000,15,15)
       END

Any idea why it does not work in IF...ELSE statement?

Thank you.

KC

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by lara_
0

The severity level I used in testing is 15. By right, more than 10 should trigger exception.

0

try to check if it was handled by a try catch function before it reach to your designated exception error to show. Also check if the option show exception error is check/included.

0

Hi Jireh, There are no try catch function in between. I catch the exception in the function that call ExecuteNonQuery.

About the "show exception" checking option, I do not know where to check it. Can you show me where can I check that?

Thanks!

KC

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.