打开SQL数据库连接时出错 [英] error in openning sql database connection

查看:86
本文介绍了打开SQL数据库连接时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个以相同方式创建的sql数据库,它们在同一个路径中。

i可以打开一个但是在打开另一个时我得到了这个错误:



尝试为文件xxx.mdf附加自动命名的数据库失败。存在一个同名的数据库,或者指定的文件无法打开,或者它位于UNC共享上

感谢您的任何建议。

i have two sql databases that are created in a same way and they are in the same path.
i can open one but in opening another one i got this error:

An attempt to attach an auto-named database for file xxx.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share
thank you for any advice.

推荐答案

检查您的登录信息。通常,您收到该消息是因为您使用的登录ID没有足够的权限。
Check your login information. Very often, you get that message because the login ID you are using does not have sufficient permissions.


问题是:

mdf文件未包含在项目。(我喜欢它在解决方案资源管理器窗口中)

i在连接字符串中使用相对路径(AttachDbFilename = | DataDirectory | ...),它会产生问题。
the problem was this :
mdf file was not included in project.(i fond it in Solution Explorer windows)
i used relative path (AttachDbFilename=|DataDirectory|...)in connection string and it makes problem.


这篇关于打开SQL数据库连接时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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