尝试为文件D:\test.mdf附加自动命名的数据库失败 [英] An attempt to attach an auto-named database for file D:\test.mdf failed

查看:137
本文介绍了尝试为文件D:\test.mdf附加自动命名的数据库失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在连接数据库时遇到问题。我收到此错误



尝试为文件D附加自动命名的数据库:\abc\abc\bin\Debug\test.mdf失败。存在一个具有相同名称的数据库,或者无法打开指定的文件,或者它位于UNC共享上。



我的连接字符串:



< connectionstrings>

< add name =abc.Properties.Settings.abcConnectionString

connectionString =Data Source =。 \ SQLEXPRESS; AttachDbFilename = | DataDirectory | \test.mdf; Integrated Security = true/>





我尝试过:



尝试为文件D附加自动命名的数据库:\ abc.mdf失败

解决方案

AttachDBFileName 是邪恶的,请看这个问题:

如何连接到2015年可视化stadio中的旧版本数据库 [ ^ ]

另见:坏习惯:使用AttachDBFileName - SQL Sentry [ ^

I've got a problem connecting to my Database. I get this error

An attempt to attach an auto-named database for file D:\abc\abc\bin\Debug\test.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

my connection string :

<connectionstrings>
<add name="abc.Properties.Settings.abcConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test.mdf;Integrated Security=true" />


What I have tried:

An attempt to attach an auto-named database for file D:\abc.mdf failed

解决方案

AttachDBFileName is evil, see this question:
How do I connect to old version database in visual stadio 2015[^]
Also see: Bad habits : Using AttachDBFileName - SQL Sentry[^]


这篇关于尝试为文件D:\test.mdf附加自动命名的数据库失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆