I have created a sample database using SQL Server 2014 Express and added it to my Windows Form solution. When double click on it to open I get this error.
The database cannot be opened because it is version 782. This server supports version 706 and earlier. A downgrade path is not supported
I am using Visual Studio 2013. I really don't understand that I am using the two latest versions of Microsoft products and they are incompatible. Am I missing something? How can I open this database?
This solution solve my problem: (from: https://msdn.microsoft.com/en-us/library/ms239722.aspx)
To permanently attach a database file (.mdf) from the Data Connections node
Open the shortcut menu for Data Connections and choose Add New Connection.
The Add Connection dialog box appears.
Choose the Change button.
The Change Data Source dialog box appears.
Select Microsoft SQL Server and choose the OK button.
The Add Connection dialog box reappears, with Microsoft SQL Server (SqlClient) displayed in the Data source text box.
In the Server Name box, type or browse to the path to the local instance of SQL Server. You can type the following:
For information about SQL Server Express LocalDB and SQL Server Express, see Local Data Overview.
Select either Use Windows Authentication or Use SQL Server Authentication.
Choose Attach a database file, Browse, and open an existing .mdf file.
Choose the OK button.
The new database appears in Server Explorer. It will remain connected to SQL Server until you explicitly detach it.
For me using solution provided by codedom did not worked. Here we can only changed compatibility version of exiting database.
But actual problem lies that, internal database version which do not matches due to changes in there storage format.
Check out more details about SQL Server version and their internal db version & Db compatibility level here So it would be good if you create your database using SQL Server 2012 Express version or below. Or start using Visual Studio 2015 Preview.
Try to change the compatibility level, worked for me.
Verify what level it is
Then make it compatible with the older version
By default, Sql Server 2014 will change the db versions compatibility to only 2014, using the
@@ version
you should be able to tell, which version Sql Server is.Then run the command above to change it the version you have.
Additional step: Ensure you look at the accessibility of the DB is not reset, do this by right clicking on properties of the folder and the database. (make sure you have rights so you don't get an access denied)
Another solution is to migrate the database to e.g 2012 when you "export" the DB from e.g. Sql Server manager 2014. This is done in menu Tasks-> generate scripts when right-click on DB. Just follow this instruction:
https://www.mssqltips.com/sqlservertip/2810/how-to-migrate-a-sql-server-database-to-a-lower-version/
It generates an scripts with everything and then in your SQL server manager e.g. 2012 run the script as specified in the instruction. I have performed the test with success.
Try changing Tools > Options > Database Tools > Data Connections > SQL Server Instance Name.
The default for VS2013 is
(LocalDB)\v11.0
.Changing to
(LocalDB)\MSSQLLocalDB
, for example, seems to work - no more version 782 error.