Cannot attach the file ‘{0}' as database '{1}'

EF使用CodeFirst,当使用localDB时,删除mdf文件,会报“Cannot attach the file ‘{0}‘ as database ‘{1}‘”错误。

解决方法如下:

1、打开Visual Studio 命令提示

2、sqllocaldb.exe stop v11.0

3、sqllocaldb.exe delete v11.0

然后重新生成数据库文件即可

Cannot attach the file ‘{0}' as database '{1}'

时间: 2024-10-11 02:49:28

Cannot attach the file ‘{0}' as database '{1}'的相关文章

Cannot attach the file as database

Cannot attach the file as database这个异常是在EF的code frist里经常出现的,解决方法很简单,只要重新启动一下V11实例即可. CMD> sqllocaldb.exe stop v11.0 LocalDB instance "v11.0" stopped. CMD> CMD> sqllocaldb.exe delete v11.0 LocalDB instance "v11.0" deleted. CMD&

Cannot attach the file 'E:\TeamWork\Fido\Fido.WebSite\App_Data\FidoData.mdf' as database 'FidoData'.

打开GuGet命令框,输入如下命令就可以了 PM> sqllocaldb.exe stop v11.0 LocalDB instance "v11.0" stopped. PM> PM> sqllocaldb.exe delete v11.0 LocalDB instance "v11.0" deleted. PM> sqllocaldb.exe start v11.0 LocalDB instance "v11.0" s

Cannot attach the file as database 'membership'.

Cannot attach the file 'D:\GitHome\cae\CAE\App_Data\membership.mdf' as database 'membership'. 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息. 异常详细信息: System.Data.SqlClient.SqlException: Cannot attach the file 'D:\GitHome\cae\CAE\App_

EF架构~Cannot attach the file as database

回到目录 Cannot attach the file as database这个异常是在EF的code frist里经常出现的,解决方法很简单,只要重新启动一下V11实例即可. CMD> sqllocaldb.exe stop v11.0 LocalDB instance "v11.0" stopped. CMD> CMD> sqllocaldb.exe delete v11.0 LocalDB instance "v11.0" deleted.

异常处理:Cannot attach the file as database 'membership'.

Cannot attach the file 'D:\GitHome\cae\CAE\App_Data\membership.mdf' as database 'membership'. 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息. 异常详细信息: System.Data.SqlClient.SqlException: Cannot attach the file 'D:\GitHome\cae\CAE\App_

【翻译自mos文章】V$BACKUP_DATAFILE 中显示file#=0 有损坏

来源于: V$BACKUP_DATAFILE Shows Corruptions for File #0 (文档 ID 399113.1) 适用于: Oracle Database - Enterprise Edition - Version 9.2.0.1 to 11.1.0.6 [Release 9.2 to 11.1] Information in this document applies to any platform. 症状: 当查询v$backup_datafile时,发现对于fi

RESTORE detected an error on page (0:0) in database

在测试服务器还原生产服务器的一个数据库时遇到了下面错误: System.Data.SqlClient.SqlError: RESTORE detected an error on page (0:0) in database "xxxx" as read from the backup set. (Microsoft.SqlServer.SmoExtended) 对数据库备份进行验证(Verfify Backup Media)时,报如下错误:Backup media verificat

odoo-10.0 create database 失败

在初始化数据库的界面点击[create database] create database 失败 报错如下 2017-01-05 20:15:18,529 4652 INFO ? werkzeug: 127.0.0.1 - - [05/Jan/2017 20:15:18] "GET / HTTP/1.1" 303 -2017-01-05 20:15:18,835 4652 INFO ? werkzeug: 127.0.0.1 - - [05/Jan/2017 20:15:18] &qu

uninstall 11.2.0.3.0 grid & database in linux 5.7

OS: Oracle Linux Server release 5.7 DB: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production 1.以oracle用户登录启动dbca [[email protected] ~]# su - oracle [[email protected] ~]$ dbca 会逐一删除所有节点的database 2.用oracle用户登录并在cd $ORACLE_HOME/