Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot connect to SQL Server Express 2014 from Visual Studio 2012

My question is regarding retrieving data from SQL Server (Express 2014) into Visual Studio (Professional 2012). I am following a tutorial re usage of the drop down list. When I use 'Choose Data Source' I can proceed as far as selecting the database. When I try to use 'Microsoft SQL Server Database File (SqlClient)' and select 'NORTHWND.MDF' from my App_Data folder I get this error:

The attempt to attach to the database failed with the following information: A network-related or instance-specific error occurred while establishing an 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: SQL Network Interfaces, error:50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.)

I have nothing in the log re this.

When I try and connect to SQL Server using 'Microsoft SQL Server' I can get to the SQL Server Instance, select the database and get 'Connection Successful' but on OK get this error:

Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version 11.0.0.0 Culture=neutral, Public Key Token=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

I have installed SQLLocalDB.

Help greatly appreciated as this is holding up my studies. Thank you.

like image 945
user3187383 Avatar asked May 05 '14 18:05

user3187383


People also ask

What version of Visual Studio is compatible with SQL Server 2012?

However, if Visual Studio 2010 Shell (Isolated) or Shell (Integrated) is installed with SQL Server 2014 or SQL Server 2012, Visual Studio 2010 Shell will be supported until the end of support for SQL Server 2014 (07/09/2024) or for SQL Server 2012 (07/12/2022).

How do I configure SQL Express 2012 to accept remote connections?

Right click on the Server name and select properties. In the Select a page section of the Server properties dialog click Connections. Check the box next to "Allow remote connections to this server". Click OK to close the server properties dialog.

Can't connect to remote SQL Server Express?

Check to see if allow remote connections for this server is enabled. In SSMS, right click on the instance name and select Properties. Go to the Connections tab and make sure Allow remote connections to this server is checked. If you need to make a change, you must restart the SQL Server instance to apply the change.

How do I enable remote connections in SQL Server 2014 Express?

Security & ConnectionsRight-click on your server name and click 'Properties'. Go to the Security page for Server Authentication, and select 'SQL Server and Windows Authentication' mode. Then, go to the Connections page and ensure that "Allow remote connections to this server" is checked, and click OK.


1 Answers

I finally found a message in the application event log which pointed out an incompatibility issue... I presumed this was between VS 2012 and SQL Server 2014. Accordingly I installed SQL Server 2012. Subsequently running a 'Web Application' in VS 2012 I found that the 'Register' function in the automatically created page correctly created a user whereas previously it had failed with the error originally posted. I am assuming that all SQL Server related activities in VS 2012 will now work, but will report back here if I find otherwise.

like image 156
user3187383 Avatar answered Sep 19 '22 06:09

user3187383