当前位置:Gxlcms > 数据库问题 > Cannot attach the file ‘{0}' as database '{1}'

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

时间:2021-07-01 10:21:17 帮助过:3人阅读

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}'

标签:

人气教程排行