Solved

SQL Server 2014 ADO

Posted on 2014-10-01
5
200 Views
1 Endorsement
Last Modified: 2014-10-05
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
Comment
Question by:Alyanto
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40354381
Is the SQL Server service running?
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40354391
Is this a named instance? Is the SQL Server Browser Service running?
0
 
LVL 1

Author Comment

by:Alyanto
ID: 40354801
Yes it is running.  I suspect it might be a firewall issue even though it is a local database.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40354818
It shouldn't be if you're running locally. You can try turning off Windows Firewall to rule it out, though.
0
 
LVL 1

Author Closing Comment

by:Alyanto
ID: 40362155
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now