Click here to Skip to main content
15,915,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
A network-related or instance-specific error occurred while establishing a connection to SQL Server.
The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Posted
Updated 28-Jun-12 23:53pm
v2
Comments
bbirajdar 4-Feb-12 11:09am    
Your connection string is wrong....

From the info you have given us, we can't be sure.
You need to look at your connection string, probably, and make sure that it points to a valis SQL server instance, that hosts your database.

Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.
 
Share this answer
 
Your connection string is wrong.

Create a connection string with these steps:

1. create a file with any name but 'udl' as extension
2. Double click the file and follow the wizard.
3. Select 'Microsoft OLEDB Provider for SQL Server'
4. In 'Connection' tab, select the database , enter sql server credentials and click 'test connection ' button.
5. Open the .udl file in notepad. It will contain the connection string. Use this in your config files
 
Share this answer
 
refere this site

Connection String
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900