简体   繁体   中英

Error with SQL Server database in Visual Studio after using LINQPad

I have an SQL Server database which is being used for a MVC 4 project in VS 2010. I'm using LINQPad to run queries against my database. When I open LINQPad, I can connect to my .mdf database file and run queries as expected. When I close LINQPad, open up VS and try to view my database in server explorer the following error is shown:

在此处输入图片说明

I can drop the database and run the Seed() method via an Update-Database command from package manager as a workaround to the error, but it's a bit of a hassle to have to do it every time I connect to the database via LINQPad.

EDIT (for those who cannot see images):

The database 'C:..... .MDF' cannot be opened because it is version 706. This server supports version 655 and earlier. A downgrade path is not supported. Could not open new database 'C:..... .MDF'. CREATE DATABASE is aborted. An attempt to attach an auto-named database file for 'C:..... .MDF' failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Is this a common error? Anyone have any solutions?

Based on the error message you are using a visual studio 2010 db project to access SQL server 2012.

Here is the MSDN workaround

http://connect.microsoft.com/SQLServer/feedback/details/731860/unable-to-create-a-sql-server-2012-projects-in-visual-studio-2010


It seems like linqPad might be doing something to "upgrade"? A different version of linqPad might also help.

While working with corrupt Microsoft SQL Server, you come across unexpected behavior of SQL Server. In order to resolve such issues of SQL Server in an efficient manner, RecoveryFIX for SQL Database Recovery is one such proficient third party tool. By using this tool, you can easily recover your lost, corrupt or inaccessible SQL database files from all the versions of the corrupt Microsoft SQL server.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM