I have an InvalidCastException which is completely puzzling me. I have checked all the members in the stored procedure against my data provider and seems to be ok. Also in the stack trace it says ProcessRequestMain... +3742??
Here's the error;
Expand|Select|Wrap|Line Numbers
- 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: Specified cast is not valid.
- Source Error:
- Line 126: private static ComponentData DisplayComponent(IDataReader reader)
- Line 127: {
- Line 128: ComponentData component = new ComponentData(
- Line 129: null,
- Line 130: (int)reader["section_id"],
- Source File: c:\Documents and Settings\Me\Desktop\tests\TMG_test\App_Code\DAL\ComponentData.cs Line: 128
- Stack Trace:
- [InvalidCastException: Specified cast is not valid.]
- TMG.DAL.ComponentData.DisplayComponent(IDataReader reader) in c:\Documents and Settings\Me\Desktop\tests\TMG_test\App_Code\DAL\ComponentData.cs:128
- TMG.DAL.ComponentData.GetComponentById(String pageId) in c:\Documents and Settings\Me\Desktop\tests\TMG_test\App_Code\DAL\ComponentData.cs:120
- TMG.BLL.Components.ComponentInfo.GetComponentFromCache(String pageId) in c:\Documents and Settings\Me\Desktop\tests\TMG_test\App_Code\BLL\Components\ComponentInfo.cs:118
- TMG.BLL.Components._components_featureComponent.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\Me\Desktop\tests\TMG_test\_components\featureComponent.ascx.cs:20
- System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
- System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
- System.Web.UI.Control.OnLoad(EventArgs e) +80
- System.Web.UI.Control.LoadRecursive() +49
- System.Web.UI.Control.LoadRecursive() +132
- System.Web.UI.Control.LoadRecursive() +132
- System.Web.UI.Control.LoadRecursive() +132
- System.Web.UI.Control.LoadRecursive() +132
- System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3742
Any help would be appreciated.