日期:2014-05-17  浏览次数:20397 次

BalloonShopConfiguration”的类型初始值设定项引发异常。
class BalloonShopConfiguration
dbConnectionString = ConfigurationManager.ConnectionStrings["BallooShopConnection"].ConnectionString;
dbProviderName = ConfigurationManager.ConnectionStrings["BalloonShopConnection"].ProviderName;//


Web.config
 <connectionStrings><!--XX-->
  <add name="BalloonShopConnection" connectionString="Data Source=WIN-19A1D2J13NS36;Initial Catalog=BalloonShop;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>

------解决方案--------------------
唉,自己写的单词,2次都能不一样

class BalloonShopConfiguration
dbConnectionString = ConfigurationManager.ConnectionStrings["BallooShopConnection"].ConnectionString; //少了一个n
dbProviderName = ConfigurationManager.ConnectionStrings["BalloonShopConnection"].ProviderName;//


Web.config
 <connectionStrings><!--XX-->
<add name="BalloonShopConnection" connectionString="Data Source=WIN-19A1D2J13NS36;Initial Catalog=BalloonShop;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>