Click here to Skip to main content
11,704,768 members (46,925 online)
Rate this: bad
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 24-Feb-12 23:36pm
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 at 8-Nov-12 12:32pm
Nice solution, thanks a lot. bcz today i face this types of prob...
thanks again!
Uma Shankar Patel at 9-Nov-12 1:01am
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 at 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 at 20-Sep-13 5:18am
This solution worked for me. Thanks.
Member 9615112 at 31-Mar-14 9:32am
thanks this worked for me.
Member 1656214 at 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 at 6-Apr-14 1:58am
thanks!!! it works ...
Latious at 18-Apr-14 13:54pm
thanks it worked
bigyan sahoo at 28-Jul-14 7:23am
Thanks finally this solution is helpful....
M-osab at 7-Aug-14 18:49pm
it works thanks
Tarun Reddy at 22-Nov-14 2:40am
Thanks .ur solution works..
julia thomas at 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 at 12-Mar-13 0:19am
Thank you so much. It solved my problem.
Ashim Malgope at 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
0 Sergey Alexandrovich Kryukov 679
1 OriginalGriff 455
2 Andy Lanng 245
3 CPallini 242
4 Maciej Los 225
0 OriginalGriff 8,864
1 Sergey Alexandrovich Kryukov 8,245
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | 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