I am using Visual Studio 2013 C# and SQL Server 2014. I am getting an error when I try to get the database file connection string here it shows.
Failed to open a connection to the database
A network-related or instance-specific error occurred while establishing a connection to SQL server. The server was not found or 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)"
I poked around online to try to find a solution and have watched some videos too but none worked for me.
How did I try to get connection string:
- I turn off SQL Server services
- Then I copy the database file from
C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA
- Then I clicked on PROJECT in C# to Add new data source
- Then database/Dataset/New connection/change
- Then I selected Microsoft SQL Server Database File then I browsed to get database file
- I have tried different Data source, but nothing happened