如何在asp。net程序发布后,通过exe或bat、ini的形式动态配置app.cnofig中的连接字符串配置信息。
app。config在da层的da.dll文件中,或都通过页面设置也可以,需要完整实例,谢谢
app。config在da层的da.dll文件中,或都通过页面设置也可以,需要完整实例,谢谢
解决方案 »
- FCKeditor播放swf视频显示没有加载影片
- 如何在textBox里加个小图片按钮一样的按钮呢???
- web service传递List<T>问题??
- 怎样在ASP.NET中连接MySQL数据库
- 问个关于web services的应用问题,请高手进来讨论!
- 关于弹出框的控制问题
- 谁给我解决问题,我卖身了,就30分了.
- 如何生成 OpenFileDialog?
- 求教 传到服务器上的ASPX页面都显示乱码.....
- 我才接触一点asp,听说asp.net比asp更好学
- 如何设置COOKIE文件的网站名?
- 用vs2008做asp.net网站时,在拆分那里可以看见图片,但在浏览器那里却看不到。why?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DataAccess.Properties.Settings.SRMSConnectionString"
connectionString="Data Source=(local);Initial Catalog=ss;User ID=sa;pwd=bhu_keyan8.22;"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>通过程序修改数据库名,密码等,因为此文件在da层,所以这个文件在da.dll中
或者直接读写呗,都是xml文件嘛
setting.settings设置的连接字符串,只能在源码里更改,要想控制setting。settings就得操作app。config
不是在setting.settings中写吗,能直接连到ui的web.config吗
<add
key="DBConnstring"
value="server=(loacl);database=数据名;User id=sa;Pwd=密码"
/>
调用时直接用“ConfigurationManger.AppSetings("DBConnstring”)
<Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="SiteSqlServer" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="SiteSqlServer (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.SiteSqlServer.ConnectionString" Provider="System.Data.SqlClient">
</Connection>
</Connections>Unfortunately this same code does not work at design time. At design time I need to use the following: <Connections>
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="CommunityServerConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="CommunityServerConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.RunHub.Properties.Settings.GlobalReference.Default.CommunityServerConnectionString" Provider="System.Data.SqlClient">
</Connection>
</Connections>The above code works at both runtime and design time but leaves me having to update the connection string in both the DLL's app.config in which the DataSet resides and in the web.config of the WAP which references the DLL.Currently, when I am finished with dev and ready for prod I plan on returning to the method which only works at runtime to avoid multiple connection strings, but as you can see, it is cumbersome to keep switching between these methods and ideally I would like something that works correctly during both runtime and design time.It may be helpful to note that both the Web Application Project(WAP) and the Class Library(DLL) are part of the same solution.
If you need any additional info please let me know. I really appreciate your help.