Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting this error when creating tables in .mdf in visual studio 2015,
i have installed sql server 2014 and visual studio 2015 , i can edit sqlserver databases but single file .mdf in my project does not edit,

Please Help

What I have tried:

I was trying visual studio 2017 , but when i saw this error , i have uninstalled visual studio 2017 , but still facing this error in visual studio 2015,
Posted
Updated 25-Feb-23 7:25am
Comments
Dave Kreskowiak 25-Feb-23 11:04am    
As Griff has said, this has nothing to do with Visual Studio and everything to do with the version of SQL Server that was used to create the database file. You cannot use a newer version of SQL Server to create a file to be used in an older version.

If you import a DB to a higher SQL version, it gets modified to that version by default - so if you then go back to the earlier version, it will not read it because it may contain features that were added after it was released, and it doesn't want to mess the file up.

The same applies to accessing MDF files directly in your apps: if the DB is a later version than the engine you are using, it can't open it.

If you want to go back to 2015, you need to open the DB in 2017, export all the tables as SQL commands complete with data, then use those commands to recreate the DB in the earlier version of SQL Server.
 
Share this answer
 
In addition to Griffs advice, you can find downgrade information here:
How to migrate a SQL Server database to a lower version[^]

Note: when your database is very large scripting with SSMS can lead to problems, you probably will need a paid tool to accomplish this.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900