加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 无法从文件连接到数据库

发布时间:2020-12-15 18:01:30 所属栏目:百科 来源:网络整理
导读:我尝试连接:Microsoft SQL Server数据库文件(SqlClient),但我收到错误: The attempt to attach to the database failed with the following information: A network-related or instance-specific error occurred while establishing a connection to SQL
我尝试连接:Microsoft SQL Server数据库文件(SqlClient),但我收到错误:

The attempt to attach to the database failed with the following
information: A network-related or instance-specific error occurred
while establishing a connection to SQL Server. The server was not
found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections.
(provider: SQL Network Interfaces,error: 52 – Unable to locate a
Local Database Runtime installation. Verify that SQL Server Express is
properly installed and that the Local Database Runtime feature is
enabled.)

所以,我在服务器资源管理器中单击连接到数据库

这个窗口出现了.在其中我选择:Microsoft SQL Server数据库文件(SqlClient),然后浏览我的.mdf数据库文件.

点击ok会提供前面提到的错误:

服务器正在运行,我在数据库中使用Windows身份验证.
任何食物?

解决方法

您需要SQL Server Express LocalDB加载项,您可以从 here在x86& amd64版本.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读