删除数据库文件和sqllocaldb后,基础提供程序在打开时失败 [英] The underlying provider failed on Open after deleting database files and sqllocaldb

查看:224
本文介绍了删除数据库文件和sqllocaldb后,基础提供程序在打开时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调查通过Windows应用商店安装Winforms XAF,Entity Framework Code First + Desktop Bridge应用程序后,它将在用户目录中创建一个数据库.

When my Winforms XAF, Entity Framework Code First + Desktop Bridge application is installed via the Windows Store, it creates a database in the users directory.

如果删除文件,则当我尝试重新运行该应用程序时会收到错误消息.

If I delete the files then I will get an error when I try to re-run the application.

The underlying provider failed on Open

这是因为我没有正确删除数据库.

This is because I have not dropped the database properly.

如链接问题中所述.

我尝试了

sqllocaldb.exe stop MSSQLLocalDB
sqllocaldb.exe delete MSSQLLocalDB

但是它不能解决问题. 此外,我找不到要通过删除数据库(通过Management Studio 2017)连接到的SQL Server实例.

But it did not fix the problem. Moreover I cannot find the SQL Server instance to connect to ( via Management Studio 2017 ) In order to drop the database.

我在c:\ Program Files \ Microsoft SQL Server下有以下文件夹

I have the following folders under c:\Program Files\Microsoft SQL Server

[更新]

我尝试跑步

sqllocaldb.exe info mssqllocaldb 

给出了版本13.1.4001.0

which gives Version 13.1.4001.0

获取实例管道名称,以用于通过SQL Server对象资源管理器进行连接 然后,我可以创建一个同名的新数据库,然后将其删除. 但是,这并不能解决我的问题.

to get an instance pipe name to use to connect via SQL Server Object Explorer I was then able to create a new database of the same name, and then delete it. However this did not solve my problem.

[更新]

连接字符串为

"Integrated Security=SSPI;MultipleActiveResultSets=True;Data Source=(localdb)\mssqllocaldb;Initial Catalog=mydatabase"

我已经问过我现在正在考虑UWP不支持localdb

I am now thinking that localdb is not supported for UWP

推荐答案

使用Management Studio 2017,如果以管理员身份运行它,则应该能够通过可信连接连接到(localdb)\ MSSQLLocalDB.这应该会启动该服务,使您可以看到附加的数据库.从那里,您应该能够删除/创建...执行配置和设置数据库上下文所需的操作.

With Management Studio 2017, if you run it as an admin, you should be able to connect to (localdb)\MSSQLLocalDB with a trusted connection. This should bring up the service that will give you visibility to what databases are attached. From there you should be able to drop/create... do what is needed to config and set the context of the database.

这篇关于删除数据库文件和sqllocaldb后,基础提供程序在打开时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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