Server Error in '/' Application.

Invalid attempt to read when no data is present.

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.InvalidOperationException: Invalid attempt to read when no data is present.

Source Error:


Line 63:         datareader = command.ExecuteReader()
Line 64:         datareader.Read()
Line 65:         Dim str_story_title As String = datareader.Item("news_story_title")
Line 66:         
Line 67:         If datareader.Item("rel_news_story_type_id") = ConfigurationManager.AppSettings("story_type_alt_layout") Then

Source File: E:\Websites_ae\Freedomhealth\www.freedomhealth.co.uk\news_story.aspx    Line: 65

Stack Trace:


[InvalidOperationException: Invalid attempt to read when no data is present.]
   System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) +137
   System.Data.SqlClient.SqlDataReader.get_Item(String name) +24
   ASP.news_story_aspx.page_setup() in E:\Websites_ae\Freedomhealth\www.freedomhealth.co.uk\news_story.aspx:65
   ASP.news_story_aspx.Page_Load(Object sender, EventArgs e) in E:\Websites_ae\Freedomhealth\www.freedomhealth.co.uk\eflo\mer_pagestart.aspx:7
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436


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