I have a database on my computer running on SQL Server Express 2014, and I'd like other computers connected to my network to be able to connect to it using a C# program I wrote.

I've done the following:

1. turned off windows firewall. I know I don't need to do this completely, but I'm just debugging.

2. enabled TCP/IP in SQL Server Configuration Manager on the machine running the instance.

I can't change this for all machines. On the computer I'm trying to connect from, but not the computer hosting the database, I can't enable this. I'm not sure if that's a problem. However, on my machine I've enabled pretty much everything and restarted everything.

3. Remote connections are allowed

Using a .UDL file to test the connection, I found that on my computer, if I select MyComputerName as the server, I don't see my database listed. But if I enter MyComputerName\SQLEXPRESS, I do see the database and can connect to it with integrated windows security.

But if I log on another computer and use a .UDL to test the connection. I can connect if I enter MyComputerName as the server, but if I try to enter MyComputerName\SQLEXPRESS as the server, it tries really hard but then tells me

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

Again, on my computer using the following connection strings work

Server=MyMachine\SQLEXPRESS;Database=MyDatabase;Integrated Security=True;

But on another computer on the network, I get the 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)

But I know that the the server is allowed remote connections and that the instance name is running, so I'm stuck. Any ideas of where to go from here?

  • Can you connect to the instance from SSMS. you can install it on one of your machines to test connectivity Commented Jun 15, 2015 at 19:24
  • Is Allow remote connections enabled ?
    – Kin Shah
    Commented Jun 15, 2015 at 19:54
  • @Kin Yes it is. Commented Jun 15, 2015 at 19:59
  • @JamesAnderson on the machine I'm testing it on, it doesn't have SSMS installed. It has the instance running and the import/export wizard, the configuration manager, error and usage reporting, etc., but not the management studio. I'm not an admin on that machine so I can't install it. Do you think that's the problem? It can connect if I change the connection string to attach a local db from a .mdf so I'm not sure that's it. Commented Jun 15, 2015 at 20:02
  • Can you look at this post and check things that you are missing. The error is very generic.
    – Kin Shah
    Commented Jun 15, 2015 at 20:03

1 Answer 1


I found a solution. Maybe someone could expand on this, because I don't fully understand it.

When I opened Management Studio as MyMachineName\SQLEXPRESS which I normally do, attached the database there, I couldn't access it through MyMachineName\SQLEXPRESS in the connection string.

However, when I reopened Managment Studio as MyMachineName, attached the database there, and removed the \SQLEXPRESS from my connection string, I can now access it.

Problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.