I am getting this error when I try to connect using the SqlConnection object:
An error has occured 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 conncetion to SQL Server)
What do I need to change or do in order to programmatically connect to a database?
Error Connecting to SQL Sever 2005
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Scott LysleRank #49 · 31K reputationPosted Feb 27, 2008, 4:53 PM EST
http://forums.asp.net/p/1209227/2135169.aspx#2135169
Might help you out.
Vijaya KadiyalaRank #1,085 · 1.8K reputationPosted Apr 10, 2008, 7:57 AM EDT
Hi,
check out the below link
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=192622&SiteID=1
Thanks -- Vj
http://dotnetvj.blogspot.com