问题
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.
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.
I have the following folders under c:\Program Files\Microsoft SQL Server
[Update]
I tried running
sqllocaldb.exe info mssqllocaldb
which gives Version 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. 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
回答1:
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.
来源:https://stackoverflow.com/questions/53877961/the-underlying-provider-failed-on-open-after-deleting-database-files-and-sqlloca