If we are going to tell more specific sql error infromation from SQLException, we should use 'NUMBER' property of SQLException.
All the sqlexception number are come from '
master.dbo.sysmessages'
SELECT
*
FROM
master.dbo.sysmessages
Some most used number as below:
2
: 'Could not open a connection to SQL Server'
18456
: 'Login failed for user'
233
: 'A connection was successfully established with the server, but then an error occurred during the login process'
4060
: 'Cannot open database "%.*ls" requested by the login. The login failed.'