如何解决这个同名的数据库存在,所以文件无法打开? [英] How to solve this database with the same name exists, so file cannot be opened?

查看:1507
本文介绍了如何解决这个同名的数据库存在,所以文件无法打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过visualshield与visual studio 2012合作开发Windows应用程序。我收到错误:



I am working on windows application by installshield with visual studio 2012. There I got the error:

Error 38
Unable to apply a change while debugging. Source file 'C:\Users\pc\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs' was reloaded. You must restart the debugging session.





我尝试过:



此错误还...





What I have tried:

This Error Also...

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





请帮助我。 ..



Please help me...

推荐答案

阅读错误消息:

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



您正尝试将数据库附加到SQL:仅此与开发系统一起使用,SQL Server的生产版本不支持ATTACH命令,因此在大多数情况下它是一个糟糕的想法(ATTACH是一个特殊的调试版本,它会旋转SQL的新实例以防止损坏其他DBS)。

附加数据库时,它不能与现有文件同名:原因很明显。

附加数据库时,必须位于SQL代理具有完全访问权限的文件夹中 - 它不会在您的用户ID下运行,因此无法访问您的私有用户文件。

附加数据库时,它必须与要附加到的SQL实例位于同一台计算机上:您不能指定到不同物理计算机的路径(因为无法保证SQL在需要时可以使用远程位置)。 />


所以看看你的连接字符串,找出哪些是相关的。


You are trying to attach a DB to SQL: this only works with development systems, production versions of SQL Server do not support the ATTACH command so it's a poor idea in most cases anyway (ATTACH is a special debug version which spins up a "new instance" of SQL to prevent damage to other DBS).
When you attach a DB, it can't have the same name as an existing file: the reasons for that are obvious.
When you attach a DB, it must be in a folder to which the SQL agent has full access - it does not run under your user id, so it can't access your "private" user files.
When you attach a DB, it has to be located on the same computer as the SQL instance you are attaching to: you cannot specify a path to a different physical computer (as there is no guarantee to SQL that the remote location will be available when it needs it).

So look at your connection string, and work out which of those is relevant.


这篇关于如何解决这个同名的数据库存在,所以文件无法打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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