title: Custom error message based on SQL Exception code
body: <p>What would be the best way to catch the SQL exception code, and then use it to produce a custom error message? </p>
  
  <p>I have a login page which fills out a custom connectionstring, then redirects to a page which uses said connection to access a database. On that page, it can throw errors depending on if I entered the correct login info, or if the database entered is wrong.</p>
  
  <p>Can I just test the connection before I get to that page, or can I catch the exception code and bring it back to the login page?</p>