简体   繁体   English

删除数据库文件和sqllocaldb后,底层提供程序在Open上失败

[英]The underlying provider failed on Open after deleting database files and sqllocaldb

I am investigating my experience of the issue here 我正在调查我在这里遇到的问题

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. 当我的Winforms XAF,Entity Framework Code First + Desktop Bridge应用程序通过Windows应用商店安装时,它会在users目录中创建一个数据库。

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. 这是因为我没有正确删除数据库。

As is explained in the linked issue. 正如链接问题中所解释的那样。

I tried the fix of 我尝试了修复

sqllocaldb.exe stop MSSQLLocalDB
sqllocaldb.exe delete MSSQLLocalDB

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. 此外,我找不到要连接的SQL Server实例(通过Management Studio 2017)以便删除数据库。

I have the following folders under c:\\Program Files\\Microsoft SQL Server 我在c:\\ Program Files \\ Microsoft SQL Server下有以下文件夹

sql server的文件夹

[Update] [更新]

I tried running 我试过跑步

sqllocaldb.exe info mssqllocaldb 

which gives Version 13.1.4001.0 它给出了版本13.1.4001.0

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. 要获取用于通过SQL Server对象资源管理器连接的实例管道名称,我可以创建一个同名的新数据库,然后将其删除。 However this did not solve my problem. 然而,这并没有解决我的问题。

[Update] [更新]

The connection string is 连接字符串是

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

I have asked a related question here 在这里了一个相关的问题

I am now thinking that localdb is not supported for UWP 我现在认为UWP不支持localdb

With Management Studio 2017, if you run it as an admin, you should be able to connect to (localdb)\\MSSQLLocalDB with a trusted connection. 使用Management Studio 2017,如果以管理员身份运行它,您应该能够使用可信连接连接到(localdb)\\ MSSQLLocalDB。 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. 从那里你应该能够删除/创建...执行配置和设置数据库上下文所需的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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