我安装了 Sql Server Express 2008 R2,并在 Sql Server Management Studio 中创建了一个数据库文件。现在,我尝试从 Visual Studio 2008 进行连接,但失败并显示错误:
Unable to open the physical file "C:.....mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". An attempt to attach an auto-named database for file C:....mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
...这是我第一次使用 Express。我之前只用过Sql精简版。这里有一些我需要弄清楚的设置吗?这不是其他连接的重名,我已经完全关闭了管理工作室。还是这个错误。我错过了什么..?
如果有一些设置,请详细说明我如何访问它们,因为我不习惯处理数据库。
最佳答案
SQL CE 是基于文件的数据库 - SQL Express 不是。
它是一个 SQL Server - 您可以使用 Server Explorer
添加它在 Visual Studio 中。
实例名称通常为.\SqlExpress
。
关于c# - 无法连接到 Sql Server Express 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4715473/