有没有办法先改变数据库中的连接字符串? [英] Is there a way to change connection string in database first?
问题描述
Thx提前!
更改web.config文件中的连接字符串。
< connectionStrings>
< add name =SandBoxEntitiesconnectionString =metadata = r ... />
< / connectionStrings>
我缩写了实际的连接字符串,因为它不重要 - 只是想给你一个在web.config文件中寻找什么的想法。
您还可以以编程方式更改连接字符串。查看示例16.2。以编程方式修改EntityConnectionString 。
I have several databases, the schema of them are same. When I use database-first, the connection string is specified when I create the edmx file. I want to know, is there a way to change the connection string? This is, so I can choose which database to operate. Thx in advance!
Change the connection string in the web.config file.
<connectionStrings>
<add name="SandBoxEntities" connectionString="metadata=r... />
</connectionStrings>
I abbreviated the actual connection string because it isn't important -- just wanted to give you an idea of what to look for in the web.config file.
You can also change your connection strings programatically. Check out Example 16.2. Programmatically modifying an EntityConnectionString.
这篇关于有没有办法先改变数据库中的连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!