I am sure this is a problem a lot of people face each day.
When you try to connect to SQL 2005 remotely, you get an error message in you application that says:
“An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)”
The most probable cause of this problem is that your SQL Server is not configured for remote connections.
The solution to this problem is to apply the configuration settings outlined in this MSDN article.
N.B. when you configure the SQL 2005 Surface Area, make sure you choose “using both TCP/IP and Named Pipes”.