A connection was successfully established with the server, but then an error occurred during the login process

A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.


This error occurs when you have the connection was established with the server, but don't close the connection yet. Seeing the event log, you will see:

Could not connect because the maximum number of '10' user connections has already been reached. The system administrator can use sp_configure to increase the maximum value. The connection has been closed.

Try to close the connection after you use it.

Example:


SqlConnection conn = new SqlConnection(strConn);
SqlCommand cmd
= new SqlCommand("SELECT here", conn);
cmd.CommandType
= CommandType.Text;
conn.Open();
SqlDataReader dr
= cmd.ExecuteReader();
if (dr.HasRows)
while(dr.Read())
{
//process dr here
}

//The connection is not closed yet!

Comments