I'm using VS2005 & SQL Server 2005 which is installed with VS2005.
Platform is XP SP2.
I've an app that connects to the DB & get some data from it .
The app & DB are on the same machine .

Suddenly When I run the app. , I've that error :

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)

I've searched over the net for that problem & I've done what others did:
1- Enable Remote Connection:Using both TCP/IP & named pipes.
2- Maker sure that the service is running .
3- Add exceptions to the firewall
Then after that ,I'm still facing the same problem .
After all trials ,I've uninstalled VS2005 & all it's component .
After installing it again ,I've the same problem .

So the Solution is ....?!!

if your sql server is running on the same box, it won't be a firewall issue, it sounds like you need to check your database permissions. check what account you have visual studio running under and enable this as a user for your database.

First ,Thanks adamm4.
Second ,I'd discouvered that the problem in the connection string . specifically in the Data Source ,althouhg , I copied it from the Conn Str prob. & it was working before.
All what I've done to make it work again is to but \\ rather than \ in the Data Source .

Hi there

try connection pooling . It may help you

<add key="DBConnection" value="Data Source=10.100.50.93;Initial Catalog=billing_production;User Id=sa;Password=;Pooling=true;Min Pool Size=2;Max Pool Size=60;Connect Timeout=180"/>

No0o00oo

i'm facing that problem too ....

and i found the same solutions above !! with no succeful result ...!!

and i'm uninstalling SQL Server 2005 right now !!!

i wish i could saw your answer just 1 min before :( !!

i'm gonna reinstalling SQL Server 2005 , and trying your answer :

( replacing "\" with "\\" , and gonna tell you about result , OK ? Thanks alot


- sorry foy my weak English :(

guys i am having the same problem. coudl you please post your connection stirng i am new to programming and i don't see \\ or \ in my connection string. my connection string is someting like this

add name="MyConnectionString" connectionString="DATA SOURCE=servername;UID=userid;PWD=password;DATABASE=mydb" providerName="System.Data.SqlClient"/>

This question has already been answered. Start a new discussion instead.