本文介绍了由于版本为852,因此无法打开。此服务器支持版本782和更早版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2017和SQL Server2014。将数据库文件附加到Visual Studio时,出现以下错误:

I am using Visual Studio 2017 and SQL Server 2014. While attaching a database file to Visual Studio, I get this error:

升级文件后,我使用了此连接字符串

After upgrading the file I used this connection string

<connectionStrings>
    <add name="con"
         connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\binaaelmamorra.mdf;Integrated Security=True;Connect Timeout=30"/>
</connectionStrings>

在我的机器上工作正常,但在客户端机器上,弹出错误提示

It's working fine on my machine, but on the client machine, an error pops up saying

尽管我在客户端安装了SQL Server 2016本地数据库,但仍然无法摆脱它。

Though I installed SQL Server 2016 local DB on the client side, I still can't get rid of it.

我的第二个问题是:与数据库文件不兼容的SQL Server当前实例是什么?

My second question is: what is the current instance of SQL Server to which the database file is not compatible?


推荐答案

似乎您的计算机上有多个版本的SQL Server实例。

It seems you have multiple instances of various versions of SQL Server on your machine.

对于成熟版本(Express和更高版本),您可以检查一下可以通过查看SQL Server配置管理器查看它们的版本:

For the "full-blown" versions (Express and up), you can check what version they are by looking at the SQL Server Configuration Manager:

对于SQL Server的 LocalDB版本(面向开发人员的版本),可以使用 sqllocaldb 命令行工具。

For the "LocalDB" versions of SQL Server (developer-oriented versions), you can use the sqllocaldb command line tool.

使用以下命令概述计算机上的内容:

Get an overview of what you have on your machine using this command:

C:\> sqllocaldb i

MSSQLLocalDB
v11.0

然后,您可以使用details命令检查单个实例:

Then, you can check the individual instances using the details command:

C:\> sqllocaldb i mssqllocaldb

Name:               mssqllocaldb
Version:            13.1.4206.0
Shared name:
Owner:              MSE-PC-02\Marc
Auto-create:        Yes
State:              Stopped
Last start time:    27.08.2017 12:24:45
Instance pipe name:


C:\> sqllocaldb i v11.0
Name:               v11.0
Version:            11.0.3000.0
Shared name:
Owner:              MSE-PC-02\Marc
Auto-create:        Yes
State:              Stopped
Last start time:    26.08.2017 15:41:18
Instance pipe name:

因此,这告诉您存在两个可用的SQL Server LocalDB实例- mssqllocaldb 是版本$ 13.1(SQL Server 2016),而 v11.0 实例是版本11.0(SQL Server 2012)。

So this tells you that there are two instances of SQL Server LocalDB available - mssqllocaldb is version 13.1 (SQL Server 2016), while the v11.0 instance is version 11.0 (SQL Server 2012).

因此,如果要将 .mdf 文件附加到这两个实例中的任何一个,则只需选择正确的一个即可使它与所需的版本一起使用。而且,一旦将数据库文件升级到较新版本的SQL Server(例如2016-内部数据库版本852),您就可以从不返回-无法分离/附加,备份/ restore或其他方式将那些二进制文件获取到旧版本的SQL Server。您必须将较新的数据库文件的结构(可能还有数据)脚本化为 .sql 文件,然后在较旧的版本上运行这些文件。

So if you want to attach a .mdf file to any one of those two instances, you just need to pick the right one in order to get it working with the version you want. And once you've "upgraded" a database file to a newer version of SQL Server (like 2016 - internal DB version 852), you can NEVER go back - there's no way to detach/attach, backup/restore or other ways to get those binary files to an older version of SQL Server. You would have to script out the structure (and possibly data) of your newer database file to .sql files and run those on the older version.

这篇关于由于版本为852,因此无法打开。此服务器支持版本782和更早版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 06:59