Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

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)

Nov 7, 2011
Introduction:

Here I will explain how to solve the problem “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)” during the time of connect to database.

Description:
                                           
Today I opened SQL Server Management Studio in my laptop to connect to database unexpectedly I got error like “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)”. I didn’t get why this happened because previously it worked perfectly. To solve this problem I did some research and found solution at that time I decided to write post to help someone who is in need with this problem.  Check below methods to solve this problem.

First Method

Open SQL Server Management Studio now Connect window will open check whether you given proper Server Type and Server Name or not because if we give incorrect details then we have a chance to get this issue.

 
Second Method

1.      Go to Start >> Select All Programs >> Microsoft SQL Server 2008 R2 >> Configuration Tools >> SQL Server Configuration Manager

 

(Note: I installed SQL Server is 2008 R2 version in my laptop that’s why I selected Configuration Tools from Microsoft SQL Server 2008 R2 in case yours is Microsoft SQL Server 2008 then select Configuration Tools from that SQL Server version)

2.      After open SQL Server Configuration Manager >> Select SQL Server Services >> Select SQL Server (MSSQLSERVER) and check the status of SQL Server (MSSQLSERVER) whether is it running or not 



3.      If SQL Server (MSSQLSERVER) Status is in Running it’s ok otherwise right click on SQL Server (MSSQLSERVER) and click Start

4.      Now select SQL Server Network Configuration >> Select Protocols for MSSQLSERVER >> TCP/IP and check status of TCP/IP whether is it enabled or not if that TCP/IP state is in Disabled state right click on it and Enable that one.














Now restart your SQL Server Management Studio and check it I hope it will work for you. 
 

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

13 comments :

Anonymous said...

Helloo sir,I am getting this error online..I have added profile section in web.config..please suggest a solution!!

Maikol said...

I have the same configuration but the conection doesn't work. What else should I test?

Asha said...

Hello Sir,

I have enabled the TCP/IP but still i am getting the same error please suggest me what i have to do.

sudesh parab said...

hello sir,
i have same error in sql server 2005, can i take same solution you given.pls send me rep..

sudesh parab said...

hello sir,
when i open (sql server services) then no any option will display.what can i do.

naveen kumar said...

thanx alot useful info

SDN said...

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)
SQL server 2005

Vivek Terdal said...

Thank You....

Ganesh Dongre said...

when connect to the server it will give me following error
'ChurchDataBase'

can you give the solution on that

Anonymous said...

itz gud thanx 4 d info...i didnt knw nythng...i always take this thngs lite wen ma seniors were teaching it
onkeshwar..
Microexcel

prakash adepu said...

thanks

Anonymous said...

I have tried all the steps you suggestd above. But still i am not able to stat that TCP/Ip protocol. and aslo not able to start MSSQLSERVER instance. Please suggest.

ankit said...

Thank You Very Much Sir :)

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.