System.Configuration.ConfigurationManager.AppSettings["connString"];

原创 2007年09月30日 17:25:00

在.net1.1 string strConnection = System.Configuration.ConfigurationSettings.AppSettings["connString"]; 在.net2.0 VS2005提示 警告: “System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete, it has been replaced by System.Configuration!

 解决方法 string strConnection = System.Configuration.ConfigurationManager.AppSettings["connString"];

对应的web.config设置为:

<appSettings>
    <add key ="connString" value ="server=(local);uid=sa;pwd=sa;database=testDataBase;"/>
  </appSettings>

另一种方法是:

        ConnectionStringSettings cs = ConfigurationManager.ConnectionStrings["hello"];
        string cn = cs.ConnectionString;

对应的web.config设置为:

 <connectionStrings>
  <add name ="hello" connectionString ="server=(local);uid=sa;pwd=sa;database=testDataBase" providerName ="System.Data.SqlClient"/> 
</connectionStrings>

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

Word add-in 通过ConfigurationManager读取configuration文件的方法

在一般的application中我们是这样读取configuration文件的 Dim DBconfig As System.Configuration.Configuration = Syst...

System.Configuration

  • 2012-07-22 21:14
  • 416KB
  • 下载

System Center 2012 Configuration Manager Overview

As consumerization of IT becomes a reality, you face new challenges. How do you deliver a rich exper...

Linux Command To Find the System Configuration And Hardware Information

Linux Command To Find the System Configuration And Hardware Information by VIVEK GITE on AUGUST ...

36. In Depth Magento System Configuration

1. and this is label 这是评论2., , in the default view, the website view, or the store view.<
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)