0

I am creating one application where I have used ASP.NET MVC with Entity Framework 4.5.2 and trying to access the SQL Server but it gives me an error that I can't access any database so I just convert it to the single user mode.

Now after converting it to Single User mode the new error comes when I am trying to access in Server Explorer, Data Connections (Default Connection), it shows me the below dialog. I am not understand what is going wrong.

I have SQL Server version 11.0.2100.60.

Please some one help me to solve this issue!

enter image description here

3 rules
  • 1,359
  • 3
  • 26
  • 54
  • see - http://stackoverflow.com/questions/26346647/the-database-cannot-be-opened-because-it-is-version-782-this-server-supports-ve or http://stackoverflow.com/questions/25500912/trying-to-attach-a-database-fails-because-it-is-version-782 – James P Sep 27 '16 at 08:18
  • @JamesP Both I have used but not gettting the solutions. – 3 rules Sep 27 '16 at 08:40
  • You need newer version of SQL server and tools, – Mark Homer Sep 27 '16 at 09:04
  • @MarkHomer Ohhh but I have boundry not to use beyond existing softwares than how can I do it? – 3 rules Sep 27 '16 at 09:12
  • I don't think you can with that database file, you cant downgrade. You would need to create a new one with lower version and copy database structure and data into it – Mark Homer Sep 27 '16 at 09:17
  • @MarkHomer Can I do it manually I mean I have mdf file with me so can I just do restore with the lower version? – 3 rules Sep 27 '16 at 09:18

2 Answers2

1

This worked for me (using Visual Studio 2015 community)...

  • In Server Explorer right-click the desired connection and select Modify Connection
  • Select Advanced Options
  • Change the Data Source to a different version (In my case it needed to be SQL express) press OK.

Hope it helps

Jesse
  • 21
  • 3
0

Ufffff after so many solutions applied I found one from it.

Steps:

1) Change Instance name in Visual Studio Link:

Under Tools > Options > Database Tools > Data Connections > SQL Server Instance Name. set (LocalDB)\MSSQLLocalDB

2) Change your connection string:

From:

<add name="DefaultConnection" connectionString="Data Source=./SQLExpress;AttachDbFilename=|DataDirectory|\DBName.Service-20160924032113.mdf;Initial Catalog=DBName.Service-20160924032113;Integrated Security=True;"providerName="System.Data.SqlClient" />

To:

<add name="DefaultConnection" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\DBName.Service-20160924032113.mdf;Initial Catalog=DBName.Service-20160924032113;Integrated Security=True;"providerName="System.Data.SqlClient" />

3) Remove User Instance=True from Connection String.

Thanks to James P and Mark Homer for excellent response.

Community
  • 1
  • 1
3 rules
  • 1,359
  • 3
  • 26
  • 54