Click here to Skip to main content
11,924,800 members (56,869 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET

Can anyone know why this error comeing?

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)how to solve this error?
Posted 25-Feb-12 0:36am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

check these things
1. Make sure your database engine is configured to accept remote connections(I you are using centralized database)
•Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
•Click on Surface Area Configuration for Services and Connections
•Select the instance that is having a problem > Database Engine > Remote Connections
•Enable local and remote connections
•Restart instance

2. Check the SQL Server service account
•If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this first before proceeding

3.If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application
•Usually the format needed to specify the database server is machinename\instancename
•Check your connection string as well
csharpbd 8-Nov-12 12:32pm
Nice solution, thanks a lot. bcz today i face this types of prob...
thanks again!
Uma Shankar Patel 9-Nov-12 1:01am
Dev Concept 27-Oct-15 1:41am
Thanks. Worked for me.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The error is pretty explicit - and it even tells you what to do.
Check your connection string - in all probability it does not reference the SQL server instance correctly.
Harpreet_125 7-Oct-13 7:00am
then how i am able to access data from the server??
Rate this: bad
Please Sign up or sign in to vote.

Solution 6

Please go Control Panel\All Control Panel Items\Administrative Tools\services and start SQL SERVER(SQLEXPRESS).it will work.
Member 2772093 20-Sep-13 5:18am
This solution worked for me. Thanks.
Member 9615112 31-Mar-14 9:32am
thanks this worked for me.
Member 1656214 3-Jul-15 18:08pm
I encountered a very similar issue with SQL Server 2012 R2. I used the same strategy and restarted SQL Server(MSSQLSERVER) through Administrative Tools\Service then was able to connect.
Member 10651041 6-Apr-14 1:58am
thanks!!! it works ...
Latious 18-Apr-14 13:54pm
thanks it worked
bigyan sahoo 28-Jul-14 7:23am
Thanks finally this solution is helpful....
M-osab 7-Aug-14 18:49pm
it works thanks
Tarun Reddy 22-Nov-14 2:40am
Thanks .ur solution works..
julia thomas 2-Dec-14 23:58pm
thnks for ur works..
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

You can check if your computer name and the user name is same or different. if same please change the user name or computer name. u can give it a try, coz i tried all blogs, forums, Google search and lots of things for almost 1 year to solve this problem. finally i did this and it solved my problem.
Sanchita Dutta 12-Mar-13 0:19am
Thank you so much. It solved my problem.
Ashim Malgope 12-Mar-13 1:33am
you welcome
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Try adding a , and a port number as in ",1433" to the end of your connection string.

Its possible that WMI or some other service dependency required to resolve the database instance name wasnt working on you local machine.

Manually specifying the port will resolve this.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151125.3 | Last Updated 3 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100