When I tried to check an invalid connection string with an instance of SQL Server 2008 Express, I found this strange behavior: specifying an invalid Initial Catalogcalls SQLException, the number of which is sometimes 233, and sometimes 18456.
The code can better illustrate it.
string invalidConnString = @"Data Source=.\SQLEXPRESS;Initial Catalog=INVALID_DATABASE_NAME;User Id=dummyUser;Password=dummyPassw;";
SqlConnection connection = new SqlConnection(invalidConnString);
try
{
connection.Open();
}
catch (SqlException sex)
{
Console.WriteLine(sex.Number);
throw;
}
finally
{
connection.Close();
}
system error codes from the Books online store determine that
- 233 . The connection to the server was successfully established, but then an error occurred during the registration process. (provider: shared memory provider, error: 0 - no process is on the other end of the pipe.)
- 18456 - Login failed for user '%. * ls'.%. * ls
, : . , ?