Is this code correct in means of Try/Catch? I need to value whether the action is done or not to inform the user about the result, so I will then get the bool value to know if connection was successful. Answer Your method can actually have 3 outcomes: The table was created successfully (method returns true) The table already exists
Tag: exception-handling
Is it OK to swallow an exception for DB INSERT
Is it OK to swallow Duplicate key violation exceptions for INSERTS or should you check if the record exists? So let’s say that I have a table Photo with one field: PhotoName. I’m looking through a file directory to add items to Photo. In the process, it’s possible that when I find a photoname, it might already be in the
Throw exception from SQL Server function to stored procedure
I have stored procedure in SQL Server 2012 say spXample and a scaler-valued function say fXample. I call a function fXample from spXample. Can I throw an exception in function and catch it in stored …
PDO Exception Questions – How to Catch Them
I’m using PDO to re-write a website interface for a database. I used to use the mysql extension, but I had never bothered with error handling, and the few error handlers I had were basically copy-paste. Now I’d like to do this right. However, I’m having issues catching the errors how I’d like (errors like “Duplicate Entry”, “Null Value” etc