422,023 Members | 1,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,023 IT Pros & Developers. It's quick & easy.

Raise Error problem when connecting to SQL Server through ODBC

P: 2
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:

Expand|Select|Wrap|Line Numbers
  1.        CREATE PROC xxx
  2.        AS
  3.          IF 1=1
  4.            BEGIN
  5.              raiserror (70000,15,15)
  6.            END

2. RaiseError triggered exception:

Expand|Select|Wrap|Line Numbers
  1.        CREATE PROC xxx
  2.        AS
  3.          IF 1=1
  4.            BEGIN
  5.              raiserror (70000,15,15)
  6.              raiserror (70000,15,15)
  7.            END
Expand|Select|Wrap|Line Numbers
  1.        CREATE PROC xxx
  2.        AS
  3.        BEGIN
  4.          raiserror (70000,15,15)
  5.        END

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

Thank you.

KC
Nov 10 '09 #1

✓ answered by ck9663

It managed to work on mine. Here's the error that returned:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Msg 18054, Level 16, State 1, Procedure xxx, Line 6
  3. Error 70000, severity 15, state 15 was raised, but no message with that error number was found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage.
  4.  
  5.  
Happy Coding!!!


--- CK

Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
It managed to work on mine. Here's the error that returned:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Msg 18054, Level 16, State 1, Procedure xxx, Line 6
  3. Error 70000, severity 15, state 15 was raised, but no message with that error number was found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage.
  4.  
  5.  
Happy Coding!!!


--- CK
Nov 10 '09 #2

P: 2
Hi ck9663,

The testing is done in Sql Server Query Windows/Pane right?
This testing works on my side too.

But when I connect VB.NET system through ODBC to SQL Server, the raise error inside IF statement does not work. No exception is triggered.

Thank you.

KC
Nov 11 '09 #3

ck9663
Expert 2.5K+
P: 2,878
Here, read this...

Happy Coding!!!

--- CK
Nov 11 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.