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 6704:                        if (loop > 2)
Line 6705:                        {
Line 6706:                            throw ex;
Line 6707:                        }
Line 6708:                    }

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

Stack Trace:


[InvalidCastException: Object cannot be cast from DBNull to other types.]
   W2.DAL.SqlClient.SqlWeatherForecastProvider.GetSnowReport(Int32 location_id) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\App_Code\DAL\SqlClient\SqlWeatherForecastProvider.cs:6706
   W2.BLL.WeatherForecast.WeatherSnowReport.GetSnowReport(Int32 location_id) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\App_Code\BLL\WeatherForecast\WeatherSnowReport.cs:166
   Activity_snow_report.Page_Load(Object sender, EventArgs e) in d:\W2Applications\Web\MyWeather2COMV2MySQL-DEV\Activity\snow-report.aspx.cs:107
   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