Solved

SQL Server 2014 ADO

Posted on 2014-10-01
5
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

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!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

710 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