如何更改整个项目的ConnectionString? [英] How do you change the ConnectionString for Entire Project?

查看:89
本文介绍了如何更改整个项目的ConnectionString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在家中开发此应用程序但又能够在教室中部署它时,如何更改SQL ConnectionString?需要一个小的example.thanks

How do I change the SQL ConnectionString when I am developing this appliaction in my home and yet be able to deploy it at my class room ? need small example.thanks

推荐答案

为此,您可以将connectionstring放在web.config文件中.您可以将连接字符串如下所示放在配置"部分下,然后在将应用程序移至教室时更改,只需更改web.config中的值即可.
For this purpose you can put connectionstring in web.config file. you can put connection string as below under configurations section and ater when you move your application to class room just change value in web.config.
 <appsettings>
 <add key="constring" value="actual connectionstring" />
</appsettings>


这篇关于如何更改整个项目的ConnectionString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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