Raise error does not triggered VB.Net Exception

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2004
Posts: 17
Reputation: lara_ is an unknown quantity at this point 
Solved Threads: 0
lara_'s Avatar
lara_ lara_ is offline Offline
Newbie Poster

Raise error does not triggered VB.Net Exception

 
0
  #1
25 Days Ago
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:

  1. CREATE PROC xxx
  2. AS
  3. IF 1=1
  4. BEGIN
  5. raiserror (70000,15,15)
  6. END

2. RaiseError triggered exception:

  1. CREATE PROC xxx
  2. AS
  3. IF 1=1
  4. BEGIN
  5. raiserror (70000,15,15)
  6. raiserror (70000,15,15)
  7. END
  8.  
  9.  
  10. CREATE PROC xxx
  11. AS
  12. BEGIN
  13. raiserror (70000,15,15)
  14. END


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

Thank you.

KC
Last edited by peter_budo; 25 Days Ago at 12:37 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 8
Reputation: lolafuertes is an unknown quantity at this point 
Solved Threads: 1
lolafuertes lolafuertes is offline Offline
Newbie Poster
 
0
  #2
24 Days Ago
Seems related on how SQL handles the severity level.
(http://msdn.microsoft.com/en-us/library/ms178592.aspx)
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 17
Reputation: lara_ is an unknown quantity at this point 
Solved Threads: 0
lara_'s Avatar
lara_ lara_ is offline Offline
Newbie Poster
 
0
  #3
24 Days Ago
The severity level I used in testing is 15. By right, more than 10 should trigger exception.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 42
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz
 
0
  #4
23 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 17
Reputation: lara_ is an unknown quantity at this point 
Solved Threads: 0
lara_'s Avatar
lara_ lara_ is offline Offline
Newbie Poster
 
0
  #5
21 Days Ago
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
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC