<appSettings> <add key="HotelOpenDay" value="2013-04-30"></add> <add key="HotelColseTime" value="18"></add> </appSettings>
读取数据出错的代码
HotelOpenDay = Convert.ToDateTime(System.Configuration.ConfigurationSettings.AppSettings["HotelOpenDay"]); HotelCloseTime = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["HotelCloseTime"]);
上面的代代码改为:
HotelOpenDay = Convert.ToDateTime(System.Configuration.ConfigurationManager.AppSettings["HotelOpenDay"]); HotelCloseTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["HotelCloseTime"]);