Saturday, March 19, 2016

Unable to connect to localdb when using sql server 2014 ,name changed to MSSQLLocalDB

While running mvc 5 application i tried using sql server 2014 Localdb but when i click the registration link i faced an error.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

After searching on google i found from microsoft website that from sql server 2014 localdb versions will not be like v11.0 ,Now they have changed the localdb instance as MSSQLLocalDB .So i was unable to connect to (LocalDB)\v11.0.
Below are the 2 connection string versions that are to be used for connecting to sql server localdb.
For Sql Server 2012 

<connectionstrings> <add connectionstring="Data Source=(LocalDB)\v11.0;
AttachDbFilename=|DataDirectory|\aspnet-AspnetIdentitySample-20130627083537_2;
Integrated Security=True;Integrated Security=True" 
name="DefaultConnection" providername="System.Data.SqlClient"> </add> </connectionstrings> For Sql Server 2014

<connectionstrings> <add connectionstring="Data Source=(LocalDB)\MSSQLLocalDB;
AttachDbFilename=|DataDirectory|\aspnet-AspnetIdentitySample-20130627083537_2;
Integrated Security=True;Integrated Security=True"
name="DefaultConnection" providername="System.Data.SqlClient"> </add> </connectionstrings>