-1

I have an existing ASP.NET MVC project which previously was connecting to SQL Server 2012. But now I have only SQL Server 2014 installed and it can not connect.

connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspn‌​et-Vidly-20160330105‌​730.mdf;Initial Catalog=aspnet-Vidly-20160330105730;Integrated Security=True"

My Sql Server works ok, I have version problem, the project is taken from another pc Which had installed SQL-Server 2012 , Now I am trying to run with SQL-Server 2014 installed !!!

It is trying to connect to SQL Server 2012. How can I fix this?

This question may already have an answer here: - I could not find anything helpful.

user3548808
  • 93
  • 10
  • 1
    Can you show your connection string? – Izzy Apr 20 '17 at 11:28
  • connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-Vidly-20160330105730.mdf;Initial Catalog=aspnet-Vidly-20160330105730;Integrated Security=True" – user3548808 Apr 20 '17 at 11:31
  • There could be a different name of the db instance. Connect to the db server from sql management studio. And use the same db server name and instance name in the connection string. – Chetan Apr 20 '17 at 11:31
  • 1
    Possible duplicate of [Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?](http://stackoverflow.com/questions/18060667/why-am-i-getting-cannot-connect-to-server-a-network-related-or-instance-speci) – Liam Apr 20 '17 at 12:11
  • Tl;Dr it could be because of lots of reasons. – Liam Apr 20 '17 at 12:12

1 Answers1

0

Looks like there is a problem with your connection string in the application.

This is the standard connection string to connect local DB:

<add name="ConnectionStringName"
    providerName="System.Data.SqlClient"
    connectionString="Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\DatabaseFileName.mdf;InitialCatalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />

An example with credentials:

<add name="ConnectionStringName"
    providerName="System.Data.SqlClient"
    connectionString="Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True" />

For more information visit: https://msdn.microsoft.com/en-us/library/jj653752(v=vs.110).aspx

manuzi1
  • 1,068
  • 8
  • 18