Visual Studio 2010抱怨数据库版本 [英] Visual Studio 2010 complains about database versions

查看:117
本文介绍了Visual Studio 2010抱怨数据库版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再见!

好吧,所以我想做的就是将数据库保留在App_Data文件夹中以便于使用,现在我觉得这很容易:将数据库复制到文件夹中并更改连接字符串.但是当我尝试这样做时,我得到了可怕的版本错误:

Okay so what I want to do is to keep my database in the App_Data folder for ease of use, now I thought this would be easy: Copy the database into the folder and change the connection string. But when I try that I get the horrible version error:

数据库 'C:\ USERS \GUÐMUNDUR\ DESKTOP \ TEST \ TEST \ APP_DATA \ IRIS2.MDF' 无法打开,因为它是版本 661.此服务器支持版本655和更早版本.降级路径不是 支持的.无法打开新数据库 'C:\ USERS \GUÐMUNDUR\ DESKTOP \ TEST \ TEST \ APP_DATA \ IRIS2.MDF'. CREATE DATABASE被中止.尝试 附加一个自动命名的数据库 文件 C:\ Users \Guðmundur\ Desktop \ Test \ Test \ App_Data \ IRIS2.mdf 失败的.具有相同名称的数据库 存在,或指定的文件不能为 打开,或者它位于UNC共享上.

The database 'C:\USERS\GUÐMUNDUR\DESKTOP\TEST\TEST\APP_DATA\IRIS2.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported. Could not open new database 'C:\USERS\GUÐMUNDUR\DESKTOP\TEST\TEST\APP_DATA\IRIS2.MDF'. CREATE DATABASE is aborted. An attempt to attach an auto-named database for file C:\Users\Guðmundur\Desktop\Test\Test\App_Data\IRIS2.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

现在,我想知道是否有人可以提出解决方案,我可以通过SQL脚本重新创建数据库,这样就没有问题,并且那里也没有重要的信息.

Now I was wondering if anyone can suggest a solution to this, I can recreate the database via the SQL script so there is no problem with that and there is no important (yet) information there.

有什么想法吗?

这是连接字符串:

  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|IRIS2.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

我使用的解决方案

The solution I used

我进入了SQL Server Management Studio,并将数据库附加到那里,同时将其保留在App_Data文件夹中.然后,我进入了Visual Studio,创建了一个新的数据连接,然后单击它,进入属性"选项卡,并从连接字符串"中选择了所有内容,然后用它替换了原来的内容.

I went into the SQL Server Management Studio and attached the database there while keeping it in the App_Data folder. Than I went into Visual Studio, created a new Data Connection and after it was created I clicked on it and went into Properties tab for it and selected everything from the Connection String and replaced what I originally had with it.

所以连接字符串现在看起来像这样:

So the connection string looks like this now:

  <connectionStrings>
    <add name="ApplicationServices"
          connectionString="Data Source=WODAN;Initial Catalog=IRIS;Integrated Security=True"
          providerName="System.Data.SqlClient" />
  </connectionStrings>

以下是附加过程的说明(由Ladislav Mrnka提供) msdn.microsoft.com/en-us/library/ms190209.aspx

Here are the instructions for the attachment process (as supplied by Ladislav Mrnka) msdn.microsoft.com/en-us/library/ms190209.aspx

感谢大家的投入,并特别感谢Ladislav帮助我度过了难关.

Thanks to everyone for their input and special thanks for Ladislav for helping me through out.

推荐答案

这意味着您的.mdf文件是由SQL Server的较新版本创建的. 661应该是SQL Server 2008 R2,并且您可能仅使用SQL Server 2008(即可以作为Visual Studio 2010安装的一部分安装的版本).

It means that your .mdf file was created by newer version of SQL Server. 661 should be SQL Server 2008 R2 and you are probably using only SQL Server 2008 (that is the version you can install as part of Visual Studio 2010 installation).

这篇关于Visual Studio 2010抱怨数据库版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆