“尝试附加自动命名的数据库”错误 [英] "An attempt to attach an auto-named database" error

查看:164
本文介绍了“尝试附加自动命名的数据库”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows XP SP2专业版的C#,Visual Studio 2010中制作桌面应用程序。



如果我直接从发布的文件夹运行该应用程序而不运行安装程序或从调试文件夹运行它或只是调试应用程序,它不会给出此错误。但是如果我从已发布的文件夹运行安装程序,然后从开始菜单运行它,它会出现这个错误:


文件C的命名数据库:\Documents和Settings\Desi\Local Settings\Apps\2.0\Data\K9KMBYK5.881\EKOOHKP2.0Y1\smas..tion_ddac366ea7cca062_0001.0000_c8a0800c5798ef15\Data\ SmasDb.mdf失败。


我正在发布应用程序到我的文档中的文件夹。


C:\Documents和Settings \Desi\Local Settings \Apps\ 2.0\Data\K9KMBYK5.881\EKOOHKP2.0Y1\smas..tion_ddac366ea7cca062_0001.0000_c8a0800c5798ef15\Data\1.0.0.0(此 Data 目录只有user.config文件。)



C:\Documents和Settings \Desi\Local Settings\Apps\2.0\LWGCKB30.QZJ\E81QYJON.ZX9\manifests(contains smas..tion_ddac366ea7cca062_0001.0000_none_a42d8ca7a940cae4.cdf毫秒smas..tion_ddac366ea7cca062_0001.0000_none_a42d8ca7a940cae4.manifest smas.exe_ddac366ea7cca062_0001.0000_none_3d144d2ce016963b.cdf毫秒smas.exe_ddac366ea7cca062_0001.0000_none_3d144d2ce016963b.manifest)



C:\Documents和Settings\Desi\Local Settings\Apps\2.0\LWGCKB30.QZJ\E81QYJON.ZX9\smas.exe_ddac366ea7cca062_0001.0000_none_3d144d2ce016963b(包含
SMAS.exe.config,SmasDb .mdf,SmasDb_log.ldf)



C:\Documents和Settings \Desi\Local Settings\Apps\2.0\LWGCKB30.QZJ\E81QYJON .ZX9 \smas..tion_ddac366ea7cca062_0001.0000_c8a0800c5798ef15(此目录具有所有文件,包括所有dll,SmasDb.mdf和SmasDb_log.ldf,SMAS.exe.config,一些.cdf-ms和.manifest文件不同于上述.cdf- ms和.manifest)



解决方案

文档和设置\USER\本地设置\Apps\2.0\Data\MP63M1NA.ZG5\BCOVJJWN.C53\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\SmasDb.mdf)以查看是否有实际上是一个数据库?



从错误消息的三个选项,我会去:或指定的文件无法打开 p>

您必须考虑数据库的位置(在非开发人员计算机上),并确保将其复制到此处。



查看帖子 工作关于| DataDirectory |的Visual Web Developer 2005 Express Edition中的数据库 语法。


I am making a desktop application in C#, Visual Studio 2010 on Windows XP SP2 Professional.

If I run that application directly from the published folder without running setup OR run it from debug folder OR simply debug the application, it does not give this error. But if I run setup from published folder and then run it from start menu, it gives this error:

An attempt to attach an auto-named database for file C:\Documents and Settings\Desi\Local Settings\Apps\2.0\Data\K9KMBYK5.881\EKOOHKP2.0Y1\smas..tion_ddac366ea7cca062_0001.0000_c8a0800c5798ef15\Data\SmasDb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

I am publishing application to a folder in 'my documents'.

C:\Documents and Settings\Desi\Local Settings\Apps\2.0\Data\K9KMBYK5.881\EKOOHKP2.0Y1\smas..tion_ddac366ea7cca062_0001.0000_c8a0800c5798ef15\Data\1.0.0.0 (this Data directory has only the user.config file.)

C:\Documents and Settings\Desi\Local Settings\Apps\2.0\LWGCKB30.QZJ\E81QYJON.ZX9\manifests (contains smas..tion_ddac366ea7cca062_0001.0000_none_a42d8ca7a940cae4.cdf-ms smas..tion_ddac366ea7cca062_0001.0000_none_a42d8ca7a940cae4.manifest smas.exe_ddac366ea7cca062_0001.0000_none_3d144d2ce016963b.cdf-ms smas.exe_ddac366ea7cca062_0001.0000_none_3d144d2ce016963b.manifest)

C:\Documents and Settings\Desi\Local Settings\Apps\2.0\LWGCKB30.QZJ\E81QYJON.ZX9\smas.exe_ddac366ea7cca062_0001.0000_none_3d144d2ce016963b (contains SMAS.exe.config, SmasDb.mdf, SmasDb_log.ldf)

C:\Documents and Settings\Desi\Local Settings\Apps\2.0\LWGCKB30.QZJ\E81QYJON.ZX9\smas..tion_ddac366ea7cca062_0001.0000_c8a0800c5798ef15 (this directory has all files including all dlls, SmasDb.mdf and SmasDb_log.ldf, SMAS.exe.config, some .cdf-ms and .manifest files NOT same as above .cdf-ms and .manifest)

解决方案

Did you verify that the long path (C:\Documents and Settings\USER\Local Settings\Apps\2.0\Data\MP63M1NA.ZG5\BCOVJJWN.C53\smas..tion_ddac366ea7cca062_0001.0000_9c79a710d42895b6\Data\SmasDb.mdf) to see if there actually is a database there?

From the three options in the error message, I would go for: or specified file cannot be opened

You'll have to think about where you want the database to be (on a non-developer computer), and make sure it is copied there.

See the post Working with Databases in Visual Web Developer 2005 Express Edition about the |DataDirectory| syntax.

这篇关于“尝试附加自动命名的数据库”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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