无法打开物理文件“C:\ x\\\.mdf” [英] Unable to open the physical file "C:\x\a.mdf"

查看:173
本文介绍了无法打开物理文件“C:\ x\\\.mdf”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何修正错误:



无法打开物理文件:c:\ x \ a.mdf。操作系统错误32:32(找不到错误)。尝试为文件c:\ x\a.mdf附加自动命名的数据库失败。存在同名的数据库,或者无法打开指定的文件,或者它位于UNC Share>





我的sqlconnection为:

Hi
how to fixed the under error :

" Unable To open physical file : " c:\x\a.mdf".operating system error 32:32(error not found")". an attemp to attach auto-named database for file c:\x\a.mdf failed. A database with same name exists, or the specified file cannot be opened,or it is in located on UNC Share"


my sqlconnection as :

using (SqlConnection con = new SqlConnection(u.connectstr))
               {
sqlcommand cmmd = new sqlcommand (x,con)
...
}





我用来解决上述错误的解决方案之一,将项目文件复制到另一个文件夹。但这是坏的和不正确的!!! ???



one of solution that I use for solve above error, copy project file to the another folder. but It is bad and incorrect !!!???

推荐答案

是的。检查文件:SQL系统可能位于不同的计算机上,并且该文件位于您的PC上。出于安全原因,远程服务器无法直接访问您计算机上的文件。



尝试直接在SQL中创建数据库,以便将其存储在正常中SQL Server数据目录,当它连接到它时它应该工作。
Yes. Check the file: the chances are that the SQL system is on a different computer, and the file is on your PC. The remote server can't access files on you computer directly for security reasons.

Try creating the database directly in SQL, so that it is stored in the "normal" SQL Server data directory and it should work when you connect to it.


这篇关于无法打开物理文件“C:\ x\\\.mdf”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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