Click here to Skip to main content
15,300,827 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,
When i try to connect to SQL Server, i am getting the below error

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (.Net SqlClient Data Provider)

Kindly help me.

What I have tried:

Creating inbound rule, changing PORT 1433, Changing the firewall settings to allow the new inbound rule
Posted
Updated 6-Jun-16 21:54pm

1 solution

There isn't really a lot we can do - we don't have any access to your network so we can't see what is going on.
I'd start by establishing a connection outside of your code, so 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.
But until you have a working connection somewhere, we're all just whistling in the dark!
   
Comments
Member 11933161 7-Jun-16 4:11am
   
Thank you for replying. I tried by right clicking on Data Connections but got the below error
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)
OriginalGriff 7-Jun-16 4:36am
   
If you are getting the problem when you right click "Data Connections" then you have real problems with your network / SQL server instance, as that pretty much just scans for servers and opens a context menu! Start by talking to the guy who set it up and administers it - if you can't even see the server at this point, then you need to know exactly why before you can go any further.

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