• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

SQL Server 2014 ADO

I have tried to make a connection to a local install of SQL Server 2014 and get this

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)

   
 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim conStr As String = "Server=localhost;Database=Marco;Trusted_Connection=True;"

        Dim conn As New SqlConnection(conStr)

        conn.Open()

    End Sub

Open in new window



I am having a problem with entity framework but though to go back to basics just to fault find.
1
Alyanto
Asked:
Alyanto
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
Is the SQL Server service running?
0
 
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Is this a named instance? Is the SQL Server Browser Service running?
0
 
AlyantoAuthor Commented:
Yes it is running.  I suspect it might be a firewall issue even though it is a local database.
0
 
käµfm³d 👽Commented:
It shouldn't be if you're running locally. You can try turning off Windows Firewall to rule it out, though.
0
 
AlyantoAuthor Commented:
I did the test as suggested and found that the connection began to work fine.  I then went onto add the port and other relevant details into the firewall white list and that has solved the problem.  This to say nothing short of a complete surprise to me that I had to do  this but a solution was wanted and found.  One detail that could have a small baring on this is that most of my C drive is compressed including windows.  I have an SSD and the performance change between compressed and uncompressed is negligible but it might have given the SQL Server setup and unrecorded problem.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now