连接字符串有问题 [英] Problem with connection string
问题描述
我正在使用VS2012中的Contoso(可能是在Visual Studio的早期版本中创建)的示例.
I'm using the Contoso (which may have been created in an earlier version of Visual Studio) example in VS2012.
我想更改连接字符串以指向外部数据库,但是当我这样做时,该程序将无法生成,尽管它没有显示有关错误原因的任何详细信息.这是我的web.config文件的格式.
I want to change the connection string to point to an external database but when I do, the program won't build, although it doesn't show any details of what the error is. Here's the format of my web.config file.
< connectionStrings>
<添加名称="_ IntrinsicData"; connectionString =数据源= otherserver \ myinstance;初始目录= ContosoMoving;用户Id = sa;密码= mypassword; MultipleActiveResultSets = True". />
</connectionStrings>
<connectionStrings>
<add name="_IntrinsicData" connectionString="Data Source=otherserver\myinstance;Initial Catalog=ContosoMoving;User Id=sa;Password=mypassword;MultipleActiveResultSets=True" />
</connectionStrings>
有人可以帮助我纠正错误吗?
Can anyone help me to correct the error?
db_csg
推荐答案
使用数据附加向导连接到外部数据库.这将正确更新web.config文件.这是有关此向导.
Use the data attach wizard to connect to the external database. This will update the web.config file correctly. Here is an MSDN article about this wizard.
这篇关于连接字符串有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!