I have a Visual Studio Express 2010 c# application using Ling-SQL. I'm getting a login failure, so I added a try-catch as follows:
Execute a Get stored procedure to read data from a table
log an error
But instead of hitting the SqlException, I get a pop up box:
Cannot open user default database. Login failed.
Login failed for user 'Harry'
This code does work for a valid user. I am purposely creating this error because I need to catch SqlExceptions.
The other issue is that the error does not appear in the SQL Server log. Is there some option for logging that I am missing?