Jump to content
  • Advertisement
Sign in to follow this  
Thevenin

Quick MSSQL 2005 Error Handling Question:

This topic is 3720 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an ASP.NET application that executes stored procedures. In the case that a stored procedure throws any error whatsoever (even a non-fatal error), I want the program to grind to halt with a descriptive exception message being displayed in the Visual Studio debugger. For some reason, I've always used @@error, or try{} catch{} in my SQL code to mask the error and rollback the transaction. However, rolling back the transaction is almost always useless to me, because it often means a more severe and fatal error will inevitably occur later down the road whose cause was masked. If I don't provide any sort of error handling in my stored procedure code, will the SQL Client throw exceptions if anything bad happens? If it doesn't, can I get it to?

Share this post


Link to post
Share on other sites
Advertisement
I'm not 100% sure on this but I seem to remember from when I worked with some SQL databases that yes, your client will still throw exceptions in this situation. Is this what you want? I find working with databases a bit tricky when it comes to exceptions because if you don't do anything about an erroneous transaction it can lead to a corrupted database - bad times!

Have you not made a test client that chucks bad data at your database? Might be a good idea to make one.

James

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!