以前写Asp.net代码,用的Web.Config配置文件中连接字符串多是         <appSettings>
           <add key=”ConnectionString” value=”Server=.;Integrated Security=SSPI;Database=Message;” />
         </appSettings>

        在Asp.Net 2.0 中新加了<connectionStrings>这一节

       <connectionStrings >
          <add />
          <clear />
          <remove />
       </connectionStrings>

        现在用起来就方便些了

       <connectionStrings>

       <add name=”Sales”
              providerName=”System.Data.SqlClient”
              connectionString= “server=myserver;database=Products;uid=salesUser;pwd=sellMoreProducts” />

       </connectionStrings>

         使用时,只需要如下即可:

        System.Configuration.ConfigurationManager.ConnectionStrings[“Sales”]