c# - 无法连接到 Sql Server Express 数据库

标签 c# sql sql-server

我安装了 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/

相关文章:

c# - 在存储过程调用中使用默认参数

mysql - 如何查找 block 传输数量并查找查询所需的操作

sql - 如何使用插入选择语句插入下一个最大值

c# - 使用 TempData 从 MVC 操作向 ViewBag 添加字符串值时出现问题

c# - ObservableCollection 在删除时以一种奇怪的模式抛出 ArgumentException(Windows Phone LongListSelector)

c# - Delegate.CreateDelegate 无法绑定(bind)到静态泛型方法

c# - 将 ref 参数与 this 关键字一起使用?

sql - 查找与 hive 中先前时间戳的天数差异

mysql - 使用单独数据库中的旧 SQL 表更新新 SQL 表

sql-server - 查询在 SQL 中运行时间不到一毫秒,但在 Entity Framework 中超时