Server Error in '/Concursos' 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 28:         GridView1.DataBind();
Line 29: 
Line 30:         OrigemCollection oc1 = OrigemManager.GetOrigemAndamento();
Line 31:         foreach (Origem o in oc1)
Line 32:         {

Source File: e:\NTOP\Sites\Unitins\Projects\Concursos\default.aspx.cs    Line: 30

Stack Trace:


[InvalidCastException: Object cannot be cast from DBNull to other types.]
   System.DBNull.System.IConvertible.ToDouble(IFormatProvider provider) +56
   System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +355
   System.Convert.ChangeType(Object value, Type conversionType) +32
   Unitins.Component.PersistenceLayer.Manager.CreateCollection(DataSet myDataSet, XmlConfigChild myXmlConfigChild) +2195
   Unitins.Component.PersistenceLayer.Manager.SearchAll(PLDataCommand myPLDataCommand, XmlConfigChild myXmlConfigChild) +177
   Unitins.Component.ComponentMaster.ManagerMaster`2.Pesquisar(PLDataCommand myPLDataCommand) +144
   Unitins.Component.Repository.Concursos.OrigemManager.GetOrigemAndamento() +67
   index.Page_Load(Object sender, EventArgs e) in e:\NTOP\Sites\Unitins\Projects\Concursos\default.aspx.cs:30
   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) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1031