将EDM添加到项目时,VS Studio错误 [英] VS studio error while adding an EDM to the project

查看:69
本文介绍了将EDM添加到项目时,VS Studio错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将ADO.net EDM添加到我的VC#win窗体项目中,该项目是通过本地mdf文件生成的.我选择MS SQL Server数据库文件作为数据源.然后,我指定文件路径.我使用Windows身份验证登录到服务器.
当我单击确定"时出现问题:

尝试为文件[文件路径]附加自动命名的数据库失败.存在具有相同名称的数据库,或者无法打开指定的文件,或者该文件位于UNC共享上."

有什么建议吗?
PS:我什至不能将mdf文件复制到其他地方,因为它正在被另一个程序使用.我不知道使用什么程序!

Im trying to add an ADO.net EDM to my VC# win forms project generating it from a local mdf file. I choose MS SQL server database file as the data source. And I specify the file path next. Im logging on to the server using windows authentication.
The problem occurs when I click OK:

"AN attempt to attach an auto-named database for file [file path] failed. a db with the same name exists, or specified file cannot be opend, or its located on UNC share."

Any suggestions?
PS: I cant even copy the mdf file to somewhere else because its being used by another program. I dont know what program!

推荐答案

您实际上已经回答了自己的问题.如果由于另一个编程而无法访问该文件,则您的EDM可能由于相同的原因而无法访问该文件.

但是,请检查错误消息的内容,并消除所有其他原因.哎呀,他们不再在学校教调试了吗?

首先,文件路径是否正确?检查拼写错误.
然后,目标数据库中是否已经存在具有相同名称的数据库?如果是这样,则必须清除它甚至更好...使用压裂数据库而不是MDF文件!!!
第三-它位于您的本地硬盘驱动器或网络共享上.它必须在您的本地驱动器上.
然后是最后一个在您张狂的脸上大叫: 或指定的文件无法打开

现在,为什么不尝试找出无法打开文件的原因(您的问题已经在其中找到了原因)
You may have actually answered your own question. If you cannot access the file due to another programming having it, then your EDM probably cannot get at it for the same reason.

But check out what the error message says and eliminate all of the other causes. Jeez, don''t they teach debugging in school anymore???!!!!

First is the path to the file correct? Check for misspellings.
Then does a database with the same name already exist in the target database? If so you have to purge it...or even better ... use the fracking database instead of an MDF file!!!
Third -- is it located on your local hard drive or a network share. It must be on your local drive.
And then comes the last one which is screaming at your freaking face: or specified file cannot be opened

Now why don''t you try and figure out why the file cannot be opened (which your question already has the cause in it)


这篇关于将EDM添加到项目时,VS Studio错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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