Server Error in '/' Application.

Object cannot be cast from DBNull to other types.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types.

Source Error:


Line 589:                        if (loop > 2)
Line 590:                        {
Line 591:                            throw ex;
Line 592:                        }
Line 593:                    }

Source File: d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\App_Code\DAL\SqlClient\SqlWeatherForecastProvider.cs    Line: 591

Stack Trace:


[InvalidCastException: Object cannot be cast from DBNull to other types.]
   W2.DAL.SqlClient.SqlWeatherForecastProvider.GetMountainWeatherSummary(Int32 location_id, DateTime startDate, Int32 number_of_days) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\App_Code\DAL\SqlClient\SqlWeatherForecastProvider.cs:591
   W2.BLL.WeatherForecast.bllMountainWeatherSummary.GetMountainWeatherSummary(Int32 location_id, DateTime validDate, Int32 number_of_days) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\App_Code\BLL\WeatherForecast\bllMountainWeatherSummary.cs:372
   activity_forecast.generateForecast(Int32 id, ActivityLocation& location, String _req_type, String& _location_name, ProfileCommon profile) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\Activity\forecast.aspx.cs:1097
   activity_forecast.Page_Load(Object sender, EventArgs e) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\Activity\forecast.aspx.cs:167
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   W2.UI.BasePage.OnLoad(EventArgs e) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\App_Code\BasePage.cs:88
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.8762; ASP.NET Version:2.0.50727.8762