无法取得ConnectionSettings的问题

app.config为

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
   <add
       name="mainDB"
       connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\Develop\COMMON\db.mdb"
       providerName="NBear.Data.MsAccess.AccessDbProvider"
   />
  </connectionStrings>
</configuration>

 

用System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]无法取得,原因是ConfigurationSettings过时了。

用System.Configuration.ConfigurationManager.ConnectionStrings["mainDB"].ConnectionString就ok了

 

posted @ 2009-06-29 23:48  jetz  阅读(408)  评论(0编辑  收藏  举报