附加数据库的问题 [英] Problem in attaching database

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

问题描述



我使用连接字符串附加数据库

Hi
I attached a database using connection string
"

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Data\ABC.mdf;User Instance=true;Initial Catalog=ABC<code><small></small></code>;Connect Timeout=30;



这很好用

我改变了我的项目位置,它没有使用新位置。

无法附加数据库已存在异常是来吧

请帮我解决问题



我尝试了什么:



"
this works well
I changed my project location ,Its not working with the new location.
Can not attach Database already exist exception is comming
please help me to solve the problem

What I have tried:

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Data\ABC.mdf;User Instance=true;Initial Catalog=ABC;Connect Timeout=30;

推荐答案

不要附加数据库,除了开发 - 它只是开发人员的特殊模式在完整版本的SQL中不存在(出于很好的理由)。您应确保生产数据库由SQL管理和控制,这意味着它会将其存储在所需的位置。



您也可以使用:简单的SQL连接字符串创建 [ ^ ]为您生成连接字符串。
Do not attach databases, except in dev - it's a special mode for dev only that does not exist in the full version of SQL (for very good reasons). You should ensure that production DB's are managed and controlled by SQL, which means it will store it where it wants.

You can also use this: Simple SQL Connection String Creation[^] to generate a connection string for you.


这篇关于附加数据库的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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